better inspect

This commit is contained in:
Torsten Ruger
2015-09-27 16:06:11 +03:00
parent 18935366fe
commit 26c6db17b1
2 changed files with 23 additions and 2 deletions

View File

@@ -1,9 +1,19 @@
module Parfait
class Variable < Object
def initialize type , name , value = nil
@type , @name , @value = type , name , value
@value = 0 if @type == :int and value == nil
raise "not type #{type}" unless type == :ref or type == :int
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