Class: Sol::RuntimeModel::SolObject
- Inherits:
-
Object
- Object
- Sol::RuntimeModel::SolObject
- Defined in:
- lib/sol/runtime/object.rb
Overview
Represents an Sol object instance in the Ruby world
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ruby_value ⇒ Object
Returns the value of attribute ruby_value.
-
#runtime_class ⇒ Object
Returns the value of attribute runtime_class.
Instance Method Summary collapse
-
#call(method, arguments = []) ⇒ Object
Call a method on the object.
-
#initialize(runtime_class, ruby_value = self) ⇒ SolObject
constructor
Each object have a class (named runtime_class to prevents errors with Ruby’s class method).
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_value ⇒ Object
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_class ⇒ Object
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 |