Class: TPPlus::Nodes::IONode
- Defined in:
- lib/tp_plus/nodes/io_node.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #eval(context, options = {}) ⇒ Object
-
#initialize(type, id) ⇒ IONode
constructor
A new instance of IONode.
- #requires_mixed_logic?(context) ⇒ Boolean
- #result ⇒ Object
Methods inherited from BaseNode
Constructor Details
#initialize(type, id) ⇒ IONode
Returns a new instance of IONode.
6 7 8 9 10 |
# File 'lib/tp_plus/nodes/io_node.rb', line 6 def initialize(type, id) @type = type @id = id.to_i @comment = "" end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
4 5 6 |
# File 'lib/tp_plus/nodes/io_node.rb', line 4 def comment @comment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/tp_plus/nodes/io_node.rb', line 5 def id @id end |
Instance Method Details
#eval(context, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/tp_plus/nodes/io_node.rb', line 20 def eval(context, ={}) s = result if [:disable_mixed_logic] s = "#{s}=ON" end [:force_parens] ? "(#{s})" : s end |
#requires_mixed_logic?(context) ⇒ Boolean
12 13 14 |
# File 'lib/tp_plus/nodes/io_node.rb', line 12 def requires_mixed_logic?(context) ["F","SO","SI","DI"].include?(@type) ? true : false end |
#result ⇒ Object
16 17 18 |
# File 'lib/tp_plus/nodes/io_node.rb', line 16 def result "#{@type}[#{@id}:#{@comment}]" end |