Class: EleetScript::PropertyNode

Inherits:
Object
  • Object
show all
Defined in:
lib/lang/nodes.rb,
lib/lang/interpreter.rb

Instance Method Summary collapse

Instance Method Details

#eval(context) ⇒ Object



293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/lang/interpreter.rb', line 293

def eval(context)
  cls = context.current_class
  properties.each do |prop_name|
    cls.def "#{prop_name}=" do |receiver, arguments|
      receiver.instance_vars[prop_name] = arguments.first
    end

    cls.def prop_name do |receiver, arguments|
      receiver.instance_vars[prop_name]
    end
  end
end