Class: Tuile::Component::LogWindow::IO
- Inherits:
-
Object
- Object
- Tuile::Component::LogWindow::IO
- Defined in:
- lib/tuile/component/log_window.rb
Overview
IO-shaped adapter that forwards each log line to the owning Tuile::Component::LogWindow. Implements both #write (stdlib ‘Logger`) and #puts (loggers that call `output.puts`, e.g. `TTY::Logger`).
Instance Method Summary collapse
- #close ⇒ void
-
#initialize(window) ⇒ IO
constructor
A new instance of IO.
- #puts(string) ⇒ void
- #write(string) ⇒ void
Constructor Details
#initialize(window) ⇒ IO
Returns a new instance of IO.
31 32 33 |
# File 'lib/tuile/component/log_window.rb', line 31 def initialize(window) @window = window end |
Instance Method Details
#close ⇒ void
55 |
# File 'lib/tuile/component/log_window.rb', line 55 def close; end |
#puts(string) ⇒ void
This method returns an undefined value.
45 46 47 48 49 |
# File 'lib/tuile/component/log_window.rb', line 45 def puts(string) @window.screen.event_queue.submit do @window.content.add_line(string) end end |
#write(string) ⇒ void
This method returns an undefined value.
37 38 39 40 41 |
# File 'lib/tuile/component/log_window.rb', line 37 def write(string) @window.screen.event_queue.submit do @window.content.add_line(string.chomp) end end |