Sha256: ebbc5351791f34459ec5b5d35c593bbccb40456d2a53afa74f3382bf04fa76a8

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

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

class TurmaliClass < TurmaliObject

  attr_reader :runtime_methods

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

  def lookup(method_name)
    method = @runtime_methods[method_name]
    raise "Method not found: #{method_name}" if method.nil?
    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

4 entries across 4 versions & 1 rubygems

Version Path
turmali-0.0.5 lib/turmali/runtime/class.rb
turmali-0.0.4 lib/turmali/runtime/class.rb
turmali-0.0.3 lib/turmali/runtime/class.rb
turmali-0.0.2 lib/turmali/runtime/class.rb