Class: Rtml::ReverseEngineering::Simulator::VariableValue
- Inherits:
-
Object
- Object
- Rtml::ReverseEngineering::Simulator::VariableValue
- Includes:
- VariableLookup
- Defined in:
- lib/rtml/reverse_engineering/simulator/variable_value.rb
Overview
Used by Rtml::ReverseEngineering::Simulator
to track the value of a variable. Attempts to build a logical value by processing the setvar’s :lo, :op and :ro attributes. References to other variables are automatically resolved. References to nonexistent values assume built-in variables and assign generic values to them.
Implements a #== method to see if one variable’s value is equal to another’s, though this may not always be accurate.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(setvar, all_variables, known_variable_types) ⇒ VariableValue
constructor
A new instance of VariableValue.
Constructor Details
#initialize(setvar, all_variables, known_variable_types) ⇒ VariableValue
Returns a new instance of VariableValue.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rtml/reverse_engineering/simulator/variable_value.rb', line 12 def initialize(setvar, all_variables, known_variable_types) @setvar, @all_variables, @known_variable_types = setvar, all_variables, known_variable_types @value = setvar.to_s %w(lo op ro).each { |i| instance_variable_set("@#{i}", resolve(self.send(i), all_variables, known_variable_types)) } catch(:done) do check_for_assignment check_for_operation end do_casting check_boundaries end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/rtml/reverse_engineering/simulator/variable_value.rb', line 10 def value @value end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/rtml/reverse_engineering/simulator/variable_value.rb', line 26 def ==(other) self.value == other.value end |