Sha256: a754e6cee056234771f8ee2e25b3543e83ba2ec4e94127ff02489f7505f2739c

Contents?: true

Size: 397 Bytes

Versions: 4

Compression:

Stored size: 397 Bytes

Contents

class Ryan
  class Assignment
    attr_reader :sexp

    def initialize(sexp)
      @sexp = sexp
    end

    def to_s
      "assigns #{name}"
    end

    # @example s(:iasgn, :@duder, s(:if, ...)
    # @example s(:op_asgn_or, s(:ivar, :@report), ...)
    def name
      if sexp.first == :iasgn
        sexp[1]
      elsif sexp.first == :op_asgn_or
        sexp[1][1]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ryan-1.2.1 lib/ryan/assignment.rb
ryan-1.2.0 lib/ryan/assignment.rb
ryan-1.1.0 lib/ryan/assignment.rb
ryan-1.0.0 lib/ryan/assignment.rb