Class: Zaid::Nodes::CallNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/zaid/nodes/call_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



5
6
7
# File 'lib/zaid/nodes/call_node.rb', line 5

def arguments
  @arguments
end

#method_nameObject

Returns the value of attribute method_name

Returns:

  • (Object)

    the current value of method_name



5
6
7
# File 'lib/zaid/nodes/call_node.rb', line 5

def method_name
  @method_name
end

#receiverObject

Returns the value of attribute receiver

Returns:

  • (Object)

    the current value of receiver



5
6
7
# File 'lib/zaid/nodes/call_node.rb', line 5

def receiver
  @receiver
end

Instance Method Details

#eval(context) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/zaid/nodes/call_node.rb', line 6

def eval(context)
  value = if receiver
            receiver.eval(context)
          else
            context.current_self
          end

  value.call(method_name, arguments.map { |argument| argument.eval(context) })
end