Method: ConfCtl::Cli::LogView#initialize

Defined in:
lib/confctl/cli/log_view.rb

#initialize(header: nil, title: nil, size: 10, reserved_lines: 0, output: $stdout) ⇒ LogView

Returns a new instance of LogView.

Parameters:

  • header (String) (defaults to: nil)

    optional string outputted above the box, must have new lines

  • title (String) (defaults to: nil)

    optional box title

  • size (Integer, :auto) (defaults to: 10)

    number of lines to show

  • reserved_lines (Integer) (defaults to: 0)

    number of reserved lines below the box when size is :auto

  • output (IO) (defaults to: $stdout)


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/confctl/cli/log_view.rb', line 55

def initialize(header: nil, title: nil, size: 10, reserved_lines: 0, output: $stdout)
  @cursor = TTY::Cursor
  @outmutex = Mutex.new
  @inlines = Queue.new
  @outlines = []
  @header = header
  @title = title || 'Log'
  @size = size
  @current_size = size if size != :auto
  @reserved_lines = reserved_lines
  @output = output
  @enabled = output.respond_to?(:tty?) && output.tty?
  @resized = false
  @stop = false
  @generation = 0
  @rendered = 0
end