Class: TurmaliClass
Instance Attribute Summary collapse
#ruby_value, #runtime_class
Instance Method Summary
collapse
#call
Constructor Details
#initialize(superclass = Constants["Class"]) ⇒ TurmaliClass
Returns a new instance of TurmaliClass.
8
9
10
11
|
# File 'lib/turmali/runtime/class.rb', line 8
def initialize(superclass=Constants["Class"])
@runtime_methods = {}
@runtime_class = superclass
end
|
Instance Attribute Details
#runtime_methods ⇒ Object
Returns the value of attribute runtime_methods.
6
7
8
|
# File 'lib/turmali/runtime/class.rb', line 6
def runtime_methods
@runtime_methods
end
|
Instance Method Details
#def(name, &block) ⇒ Object
24
25
26
|
# File 'lib/turmali/runtime/class.rb', line 24
def def(name, &block)
@runtime_methods[name.to_s] = block
end
|
#lookup(method_name) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/turmali/runtime/class.rb', line 13
def lookup(method_name)
method = @runtime_methods[method_name]
unless method
if @runtime_superclass
return @runtime_superclass.lookup(method_name)
else
raise "Method not found: #{method_name}"
end end
method
end
|
#new ⇒ Object
28
29
30
|
# File 'lib/turmali/runtime/class.rb', line 28
def new
TurmaliObject.new(self)
end
|
#new_with_value(value) ⇒ Object
32
33
34
|
# File 'lib/turmali/runtime/class.rb', line 32
def new_with_value(value)
TurmaliObject.new(self, value)
end
|