Class: Ruleby::Core::Printable
- Inherits:
-
Object
- Object
- Ruleby::Core::Printable
- Defined in:
- lib/core/nodes.rb
Overview
Any node in the network that needs to be printed extends this class. It provides handles to the nodes above it in the network. These are not used for matching (i.e. no backward-chaining).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parent_nodes ⇒ Object
readonly
Returns the value of attribute parent_nodes.
Instance Method Summary collapse
-
#initialize ⇒ Printable
constructor
A new instance of Printable.
- #print(tab) ⇒ Object
Constructor Details
#initialize ⇒ Printable
Returns a new instance of Printable.
251 252 253 254 |
# File 'lib/core/nodes.rb', line 251 def initialize # this is only used for printing the network, not for matching @parent_nodes = [] end |
Instance Attribute Details
#parent_nodes ⇒ Object (readonly)
Returns the value of attribute parent_nodes.
249 250 251 |
# File 'lib/core/nodes.rb', line 249 def parent_nodes @parent_nodes end |
Instance Method Details
#print(tab) ⇒ Object
256 257 258 259 260 261 |
# File 'lib/core/nodes.rb', line 256 def print(tab) puts tab + to_s @parent_nodes.each do |out_node| out_node.print(' '+tab) end end |