Class: Sol::RuntimeModel::SolObject

Inherits:
Object
  • Object
show all
Defined in:
lib/sol/runtime/object.rb

Overview

Represents an Sol object instance in the Ruby world

Direct Known Subclasses

SolClass, SolFunction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime_class, ruby_value = self) ⇒ SolObject

Each object have a class (named runtime_class to prevents errors with Ruby’s class method). Optionally an object can hold a Ruby value (e.g strings and numbers)



12
13
14
15
16
17
18
# File 'lib/sol/runtime/object.rb', line 12

def initialize(runtime_class, ruby_value=self)

	@runtime_class = runtime_class

	@ruby_value = ruby_value

end

Instance Attribute Details

#ruby_valueObject

Returns the value of attribute ruby_value.



8
9
10
# File 'lib/sol/runtime/object.rb', line 8

def ruby_value
  @ruby_value
end

#runtime_classObject

Returns the value of attribute runtime_class.



8
9
10
# File 'lib/sol/runtime/object.rb', line 8

def runtime_class
  @runtime_class
end

Instance Method Details

#call(method, arguments = []) ⇒ Object

Call a method on the object



21
22
23
24
25
26
# File 'lib/sol/runtime/object.rb', line 21

def call(method, arguments=[])

	# Like a typical Class-based runtime model, we store methods in the class of the object
	@runtime_class.lookup(method).call(self, arguments)

end