Class: WebConsole::REPL::OutputController
- Inherits:
-
Controller
- Object
- Controller
- WebConsole::REPL::OutputController
- Defined in:
- lib/webconsole/repl/lib/output_controller.rb
Instance Attribute Summary collapse
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(view) ⇒ OutputController
constructor
A new instance of OutputController.
- #parse_output(output) ⇒ Object
Constructor Details
#initialize(view) ⇒ OutputController
Returns a new instance of OutputController.
5 6 7 |
# File 'lib/webconsole/repl/lib/output_controller.rb', line 5 def initialize(view) @view = view end |
Instance Attribute Details
#view ⇒ Object
Returns the value of attribute view.
4 5 6 |
# File 'lib/webconsole/repl/lib/output_controller.rb', line 4 def view @view end |
Instance Method Details
#parse_output(output) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/webconsole/repl/lib/output_controller.rb', line 9 def parse_output(output) output = output.dup output.gsub!(/\x1b[^m]*m/, "") # Remove escape sequences output.chomp! if !output.strip.empty? # Ignore empty lines @view.add_output(output) end end |