lib/turmali/runtime/class.rb in turmali-0.0.5 vs lib/turmali/runtime/class.rb in turmali-0.0.6
- old
+ new
@@ -3,18 +3,24 @@
class TurmaliClass < TurmaliObject
attr_reader :runtime_methods
- def initialize
+ def initialize(superclass=Constants["Class"])
@runtime_methods = {}
- @runtime_class = Constants["Class"]
+ @runtime_class = superclass
end
def lookup(method_name)
method = @runtime_methods[method_name]
- raise "Method not found: #{method_name}" if method.nil?
+ unless method
+ puts "superclass #{@runtime_superclass}"
+ if @runtime_superclass
+ return @runtime_superclass.lookup(method_name)
+ else
+ raise "Method not found: #{method_name}"
+ end end
method
end
def def(name, &block)
@runtime_methods[name.to_s] = block
@@ -25,6 +31,7 @@
end
def new_with_value(value)
TurmaliObject.new(self, value)
end
+
end
\ No newline at end of file