Class: Namarara::VarValue
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Attributes inherited from TreeValue
Instance Method Summary collapse
- #compute ⇒ Object
-
#initialize(str, value) ⇒ VarValue
constructor
A new instance of VarValue.
- #to_s ⇒ Object
Constructor Details
#initialize(str, value) ⇒ VarValue
Returns a new instance of VarValue.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/namarara/parser.rb', line 21 def initialize(str, value) @errors = [] @name = str @value = value @value = true if value =~ /^true$/i @value = false if value =~ /^false$/i return unless @value.nil? @errors << Errors::VarNotDefined.new( message: "No value for #{@name}", var: @name ) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
19 20 21 |
# File 'lib/namarara/parser.rb', line 19 def errors @errors end |
Instance Method Details
#compute ⇒ Object
35 36 37 |
# File 'lib/namarara/parser.rb', line 35 def compute @value end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/namarara/parser.rb', line 39 def to_s "var:#{@name}<-(#{@value})" end |