Class: Repla::REPL::OutputController
- Inherits:
-
Controller
- Object
- Controller
- Repla::REPL::OutputController
- Defined in:
- lib/repla/repl/lib/output_controller.rb
Overview
Output controller
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.
6 7 8 |
# File 'lib/repla/repl/lib/output_controller.rb', line 6 def initialize(view) @view = view end |
Instance Attribute Details
#view ⇒ Object
Returns the value of attribute view.
5 6 7 |
# File 'lib/repla/repl/lib/output_controller.rb', line 5 def view @view end |
Instance Method Details
#parse_output(output) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/repla/repl/lib/output_controller.rb', line 10 def parse_output(output) output = output.dup output.gsub!(/\x1b[^m]*m/, '') # Remove escape sequences output.chomp! @view.add_output(output) unless output.strip.empty? # Ignore empty lines end |