Class: Spektr::Exp::Send
Instance Attribute Summary collapse
-
#receiver ⇒ Object
Returns the value of attribute receiver.
Attributes inherited from Base
#arguments, #ast, #body, #location, #name, #options, #type
Instance Method Summary collapse
-
#initialize(ast) ⇒ Send
constructor
A new instance of Send.
Methods inherited from Base
#handler_missing, #process, #send?
Constructor Details
#initialize(ast) ⇒ Send
Returns a new instance of Send.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/spektr/exp/send.rb', line 6 def initialize(ast) super @receiver = Receiver.new(ast.children[0]) if ast.children[0] @name = if ast.children.first.is_a?(Parser::AST::Node) ast.children.first.children.last else ast.children[1] end children = ast.children[2..] children.each do |child| next unless child.is_a?(Parser::AST::Node) case child.type when :hash if children.size == 1 || children.last == child child.children.each do |pair| @options[pair.children[0].children[0]] = Option.new(pair) end else @arguments << Argument.new(child) end else @arguments << Argument.new(child) end end end |
Instance Attribute Details
#receiver ⇒ Object
Returns the value of attribute receiver.
4 5 6 |
# File 'lib/spektr/exp/send.rb', line 4 def receiver @receiver end |