Class: Sol::FuncNode

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

Overview

Method definition.

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



73
74
75
# File 'lib/sol/nodes.rb', line 73

def body
  @body
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



73
74
75
# File 'lib/sol/nodes.rb', line 73

def name
  @name
end

#paramsObject

Returns the value of attribute params

Returns:

  • (Object)

    the current value of params



73
74
75
# File 'lib/sol/nodes.rb', line 73

def params
  @params
end

Instance Method Details

#eval(context) ⇒ Object



161
162
163
164
165
166
167
168
# File 'lib/sol/interpreter.rb', line 161

def eval(context)

	# Defining a method is adding a method to the current class
	method = RuntimeModel::SolFunction.new(params, body)

	RuntimeModel::Runtime.current_class.runtime_methods[name] = method # I think this works

end