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
262 263 264 265 |
# File 'lib/core/nodes.rb', line 262 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.
260 261 262 |
# File 'lib/core/nodes.rb', line 260 def parent_nodes @parent_nodes end |
Instance Method Details
#print(tab) ⇒ Object
267 268 269 270 271 272 |
# File 'lib/core/nodes.rb', line 267 def print(tab) puts tab + to_s @parent_nodes.each do |out_node| out_node.print(' '+tab) end end |