rubyx/lib/parfait/variable.rb
Torsten Ruger 1141ed9c99 type now means class name
update reader (with new type definition)
remove type class (now symbol)
update all types to class name symbols
2015-10-14 16:16:03 +03:00

20 lines
506 B
Ruby

module Parfait
class Variable < Object
def initialize type , name , value = nil
raise "not type #{type}" unless Virtual.machine.space.get_class_by_name(type)
self.type , self.name , self.value = type , name , value
self.value = 0 if self.type == :int and value == nil
raise "must give name for variable" unless name
end
attributes [:type , :name, :value]
def to_s
"Variable(#{self.type} ,#{self.name})"
end
def inspect
to_s
end
end
end