Class: StatSailr::Output::OutputManager
- Inherits:
-
Object
- Object
- StatSailr::Output::OutputManager
- Defined in:
- lib/statsailr/sts_output/output_manager.rb
Instance Attribute Summary collapse
-
#capture ⇒ Object
(also: #parent)
readonly
Returns the value of attribute capture.
-
#current_node ⇒ Object
readonly
Returns the value of attribute current_node.
-
#root_node ⇒ Object
readonly
Returns the value of attribute root_node.
Instance Method Summary collapse
- #add_new_message(type, content: "") ⇒ Object
-
#initialize(capture: true) ⇒ OutputManager
constructor
A new instance of OutputManager.
- #move_down ⇒ Object
- #move_to_new_node(tag) ⇒ Object
- #move_to_root ⇒ Object
- #move_up ⇒ Object
- #recurse_move_to_new_node(tag, *tags) ⇒ Object
- #reset ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(capture: true) ⇒ OutputManager
Returns a new instance of OutputManager.
114 115 116 117 118 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 114 def initialize( capture: true ) @root_node = OutputNode.new("root", self) @current_node = @root_node @capture = capture end |
Instance Attribute Details
#capture ⇒ Object (readonly) Also known as: parent
Returns the value of attribute capture.
111 112 113 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 111 def capture @capture end |
#current_node ⇒ Object (readonly)
Returns the value of attribute current_node.
111 112 113 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 111 def current_node @current_node end |
#root_node ⇒ Object (readonly)
Returns the value of attribute root_node.
111 112 113 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 111 def root_node @root_node end |
Instance Method Details
#add_new_message(type, content: "") ⇒ Object
141 142 143 144 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 141 def ( type, content: "" ) = @current_node.(type, content) return end |
#move_down ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 154 def move_down() if @current_node.children.size >= 1 @current_node = @current_node.children.last else return nil end end |
#move_to_new_node(tag) ⇒ Object
126 127 128 129 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 126 def move_to_new_node(tag) @current_node = @current_node.new_node(tag) return @current_node end |
#move_to_root ⇒ Object
146 147 148 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 146 def move_to_root() @current_node = @root_node end |
#move_up ⇒ Object
150 151 152 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 150 def move_up() @current_node = @current_node.parent end |
#recurse_move_to_new_node(tag, *tags) ⇒ Object
131 132 133 134 135 136 137 138 139 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 131 def recurse_move_to_new_node(tag , *) @current_node = @current_node.new_node(tag) if ! .nil? .each(){|child_tag| @current_node = @current_node.new_node(child_tag) } end return @current_node end |
#reset ⇒ Object
120 121 122 123 124 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 120 def reset @root_node = OutputNode.new("root", self) @current_node = @root_node return self end |
#to_s ⇒ Object
162 163 164 |
# File 'lib/statsailr/sts_output/output_manager.rb', line 162 def to_s() @root_node.to_s() end |