Class: AccessorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_diff/structure_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(label) ⇒ AccessorHandler

Returns a new instance of AccessorHandler.



73
74
75
# File 'lib/ruby_diff/structure_processor.rb', line 73

def initialize(label)
  @label = label
end

Instance Method Details

#meta_codes(args_sexp, scope) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/ruby_diff/structure_processor.rb', line 77

def meta_codes(args_sexp, scope)
  meta_codes = []
  args_sexp.sexp_body.each do |arg| 
    if name = name_for_arg(arg)
      meta_codes << MetaCode.new(name, scope, @label)
    end
  end
  meta_codes
end

#name_for_arg(name_sexp) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/ruby_diff/structure_processor.rb', line 87

def name_for_arg(name_sexp)
  identifier = name_sexp.to_a
  case identifier.first
    when :lit then identifier.last
    when :str then identifier.last.to_sym
    else nil
  end
end