Simplify values
This commit is contained in:
parent
64c3d6070c
commit
202d841be4
1 changed files with 3 additions and 9 deletions
|
@ -7,22 +7,16 @@ module Mm2ep
|
||||||
end
|
end
|
||||||
|
|
||||||
class TreeValue
|
class TreeValue
|
||||||
attr_accessor :value
|
def value
|
||||||
|
raise "No value for #{@name}" if @value.nil?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class VarValue < TreeValue
|
class VarValue < TreeValue
|
||||||
attr_accessor :value
|
|
||||||
|
|
||||||
def initialize str
|
def initialize str
|
||||||
@name = str
|
@name = str
|
||||||
@value = nil
|
@value = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def compute
|
|
||||||
# FIXME: test if @value is a boolean
|
|
||||||
# raise an exception in all other cases
|
|
||||||
@value
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class NumberValue < TreeValue
|
class NumberValue < TreeValue
|
||||||
|
|
Loading…
Reference in a new issue