Class: Namarara::BoolValue

Inherits:
TreeValue show all
Defined in:
lib/namarara/parser.rb

Instance Attribute Summary collapse

Attributes inherited from TreeValue

#value

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ BoolValue

Returns a new instance of BoolValue.



81
82
83
84
85
86
87
# File 'lib/namarara/parser.rb', line 81

def initialize(str)
  @errors = []
  @value = case str
           when /true/i then true
           when /false/i then false
           end
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



79
80
81
# File 'lib/namarara/parser.rb', line 79

def errors
  @errors
end

Instance Method Details

#computeObject



89
90
91
# File 'lib/namarara/parser.rb', line 89

def compute
  @value
end

#to_sObject



93
94
95
# File 'lib/namarara/parser.rb', line 93

def to_s
  "bool:#{@value}"
end