Method: Janeway::AST::Function#initialize

Defined in:
lib/janeway/ast/function.rb

#initialize(name, parameters, &body) ⇒ Function

Returns a new instance of Function.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
# File 'lib/janeway/ast/function.rb', line 11

def initialize(name, parameters, &body)
  raise ArgumentError, "expect string, got #{name.inspect}" unless name.is_a?(String)

  super(name)
  @parameters = parameters
  @body = body
  raise "expect body to be a Proc, got #{body.class}" unless body.is_a?(Proc)
end