introduce ruby variable and remove ct_type

cleaner oo
This commit is contained in:
Torsten Ruger
2018-07-20 20:53:35 +03:00
parent 9548440949
commit 6022aa4dab
6 changed files with 22 additions and 47 deletions

View File

@ -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