Class: Sol::RuntimeModel::SolClass
- Defined in:
- lib/sol/runtime/class.rb
Overview
Represents a Sol class in the Ruby world. Classes are objects in Sol so they inherit from SolObject
Instance Attribute Summary collapse
-
#runtime_methods ⇒ Object
readonly
Returns the value of attribute runtime_methods.
Attributes inherited from SolObject
Instance Method Summary collapse
-
#initialize ⇒ SolClass
constructor
Create a new class.
-
#lookup(method_name) ⇒ Object
Lookup a method.
-
#new ⇒ Object
Create a new instance of the class.
-
#new_with_value(value) ⇒ Object
Create an instance of this Sol class that holds a Ruby value.
Methods inherited from SolObject
Constructor Details
#initialize ⇒ SolClass
Create a new class. Number is an instance of Class for example
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sol/runtime/class.rb', line 13 def initialize @runtime_methods = {} # Check if we're bootstrapping (launching the runtime). During this process the # runtime is not fully initialised and core classes do not yet exists, so we defer # using those once the language is bootstrapped. # This solves the chicken-or-the-egg problem with the Class class. We can # initialise Class then set Class.class = Class. if defined?(Runtime) # RuntimeModel is a temporary name runtime_class = Runtime["Class"] else runtime_class = nil end super(runtime_class) end |
Instance Attribute Details
#runtime_methods ⇒ Object (readonly)
Returns the value of attribute runtime_methods.
10 11 12 |
# File 'lib/sol/runtime/class.rb', line 10 def runtime_methods @runtime_methods end |
Instance Method Details
#lookup(method_name) ⇒ Object
Lookup a method
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sol/runtime/class.rb', line 37 def lookup(method_name) method = @runtime_methods[method_name] unless method raise "Method not found: #{method_name}" end return method end |