Class: Bindy::Language::Function

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/bindy/language_interpreters.rb

Instance Method Summary collapse

Instance Method Details

#argumentsObject



35
36
37
38
39
40
41
42
43
# File 'lib/bindy/language_interpreters.rb', line 35

def arguments
  if arg_list.text_value.empty?
    []
  elsif arg_list.respond_to?(:to_a)
    arg_list.to_a 
  else
    [arg_list]
  end
end

#evaluate(context) ⇒ Object



27
28
29
# File 'lib/bindy/language_interpreters.rb', line 27

def evaluate(context)
  context.public_send name, *arguments.map { |a| a.evaluate context }
end

#nameObject



31
32
33
# File 'lib/bindy/language_interpreters.rb', line 31

def name
  identifier.text_value
end