Class: DefNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/turmali/nodes.rb,
lib/turmali/interpreter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



42
43
44
# File 'lib/turmali/nodes.rb', line 42

def body
  @body
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



42
43
44
# File 'lib/turmali/nodes.rb', line 42

def name
  @name
end

#paramsObject

Returns the value of attribute params

Returns:

  • (Object)

    the current value of params



42
43
44
# File 'lib/turmali/nodes.rb', line 42

def params
  @params
end

Instance Method Details

#eval(context) ⇒ Object



96
97
98
99
# File 'lib/turmali/interpreter.rb', line 96

def eval(context)
  method = TurmaliMethod.new(params, body)
  context.current_class.runtime_methods[name] = method
end