Sha256: 8357e58217f8270e5a83d42d4a215f9b8b3961133eb200c7c092d0ee9ea425f0

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

require "turmali/runtime/object"
require "turmali/runtime/context"

class TurmaliClass < TurmaliObject

  attr_reader :runtime_methods

  def initialize(superclass=Constants["Class"])
    @runtime_methods = {}
    @runtime_class = superclass 
  end

  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

  def def(name, &block)
    @runtime_methods[name.to_s] = block
  end

  def new
    TurmaliObject.new(self)
  end

  def new_with_value(value)
    TurmaliObject.new(self, value)
  end
 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turmali-0.0.7 lib/turmali/runtime/class.rb