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