Sha256: 0406cc81b10c208442cb7cda694be2b4e27578015aab984e46278d09ecb47575
Contents?: true
Size: 639 Bytes
Versions: 4
Compression:
Stored size: 639 Bytes
Contents
# Represents an Sweet object instance in the Ruby world. class SweetObject attr_accessor :runtime_class, :ruby_value # Each object have a class (named runtime_class to prevent errors with Ruby's class # method). Optionaly an object can hold a Ruby value (eg.: numbers and strings). def initialize(runtime_class, ruby_value=self) @runtime_class = runtime_class @ruby_value = ruby_value end # Call a method on the object. def call(method, arguments=[]) # Like a typical Class-based runtime model, we store methods in the class of the # object. @runtime_class.lookup(method).call(self, arguments) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sweet-lang-0.3.7 | lib/runtime/object.rb |
sweet-lang-0.2.2 | lib/runtime/object.rb |
sweet-lang-0.1.9 | lib/runtime/object.rb |
sweet-lang-0.1.0 | lib/runtime/object.rb |