Class: TPPlus::Nodes::IndirectNode
- Inherits:
-
Object
- Object
- TPPlus::Nodes::IndirectNode
- Defined in:
- lib/tp_plus/nodes/indirect_node.rb
Instance Method Summary collapse
- #eval(context, options = {}) ⇒ Object
-
#initialize(type, target) ⇒ IndirectNode
constructor
A new instance of IndirectNode.
- #requires_mixed_logic?(context) ⇒ Boolean
- #string ⇒ Object
Constructor Details
#initialize(type, target) ⇒ IndirectNode
Returns a new instance of IndirectNode.
4 5 6 7 |
# File 'lib/tp_plus/nodes/indirect_node.rb', line 4 def initialize(type, target) @type = type @target = target end |
Instance Method Details
#eval(context, options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/tp_plus/nodes/indirect_node.rb', line 39 def eval(context,={}) s = "#{string}[#{@target.eval(context)}]" if [:opposite] s = "!#{s}" end if [:as_condition] s = "(#{s})" end s end |
#requires_mixed_logic?(context) ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/tp_plus/nodes/indirect_node.rb', line 30 def requires_mixed_logic?(context) case @type when :flag#, :timer true else false end end |
#string ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tp_plus/nodes/indirect_node.rb', line 9 def string case @type when :position "P" when :position_register "PR" when :flag "F" when :timer "TIMER" when :register "R" when :user_alarm "UALM" when :user_frame "UFRAME" else raise "Invalid indirect type" end end |