introduce ruby variable and remove ct_type
cleaner oo
This commit is contained in:
@ -14,9 +14,6 @@ module Ruby
|
||||
end
|
||||
end
|
||||
class IntegerConstant < ValueConstant
|
||||
def ct_type
|
||||
Parfait.object_space.get_type_by_class_name(:Integer)
|
||||
end
|
||||
def to_s
|
||||
value.to_s
|
||||
end
|
||||
@ -26,30 +23,18 @@ module Ruby
|
||||
def initialize(value)
|
||||
@value = value
|
||||
end
|
||||
def ct_type
|
||||
true
|
||||
end
|
||||
end
|
||||
class TrueConstant < Constant
|
||||
def ct_type
|
||||
Parfait.object_space.get_type_by_class_name(:True)
|
||||
end
|
||||
def to_s(depth = 0)
|
||||
"true"
|
||||
end
|
||||
end
|
||||
class FalseConstant < Constant
|
||||
def ct_type
|
||||
Parfait.object_space.get_type_by_class_name(:False)
|
||||
end
|
||||
def to_s(depth = 0)
|
||||
"false"
|
||||
end
|
||||
end
|
||||
class NilConstant < Constant
|
||||
def ct_type
|
||||
Parfait.object_space.get_type_by_class_name(:Nil)
|
||||
end
|
||||
def to_s(depth = 0)
|
||||
"nil"
|
||||
end
|
||||
@ -72,16 +57,10 @@ module Ruby
|
||||
def initialize(value)
|
||||
@value = value
|
||||
end
|
||||
def ct_type
|
||||
Parfait.object_space.get_type_by_class_name(:Word)
|
||||
end
|
||||
def to_s(depth = 0)
|
||||
"'#{@value}'"
|
||||
end
|
||||
end
|
||||
class SymbolConstant < StringConstant
|
||||
def ct_type
|
||||
Parfait.object_space.get_type_by_class_name(:Word)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user