Class: Tuile::Component::LogWindow

Inherits:
Window
  • Object
show all
Defined in:
lib/tuile/component/log_window.rb,
sig/tuile.rbs

Overview

A Window framing a LogTextView — the framed log pane. All the log behavior lives on the view (see LogTextView for the adapter and the wrap rationale); the window adds the border, caption and delegation:

log_window = Tuile::Component::LogWindow.new
logger = Logger.new(Tuile::Component::LogWindow::IO.new(log_window))

Constant Summary collapse

IO =

Alias of Tuile::Component::LogTextView::IO, which accepts the window itself as its sink.

Returns:

  • (Class)
LogTextView::IO

Instance Attribute Summary

Attributes inherited from Window

#footer_text

Attributes included from HasContent

#content

Instance Method Summary collapse

Methods inherited from Window

#bottom_border, #caption, #caption=, #focusable?, #footer, #footer=, #layout, #layout_footer, #on_focus, #rect=, #repaint, #repaint_border, #scrollbar=, #top_border

Methods included from HasCaption

#caption, #caption=

Methods included from HasContent

#on_focus, #rect=

Constructor Details

#initialize(caption = "Log") ⇒ LogWindow

@param caption

Parameters:

  • caption (String) (defaults to: "Log")


17
18
19
20
# File 'lib/tuile/component/log_window.rb', line 17

def initialize(caption = "Log")
  super
  self.content = LogTextView.new
end

Instance Method Details

#log(string) ⇒ void

This method returns an undefined value.

Appends the given line to the log, from any thread — delegates to Tuile::Component::LogTextView#log.

@param string — the line (or multiple lines) to log; nil is a no-op.

Parameters:

  • string (String, nil)


27
28
29
# File 'lib/tuile/component/log_window.rb', line 27

def log(string)
  content.log(string)
end