Class: RSpec::Conductor::Util::Terminal::Box

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/conductor/util/terminal.rb

Instance Method Summary collapse

Constructor Details

#initialize(terminal) {|_self| ... } ⇒ Box

Returns a new instance of Box.

Yields:

  • (_self)

Yield Parameters:



36
37
38
39
40
# File 'lib/rspec/conductor/util/terminal.rb', line 36

def initialize(terminal)
  @terminal = terminal
  @contents = []
  yield self if block_given?
end

Instance Method Details

#boxObject



50
51
52
# File 'lib/rspec/conductor/util/terminal.rb', line 50

def box
  Box.new(@terminal) { |b| @contents << b }
end

#line(content = "", truncate: true, redraw: true) ⇒ Object



42
43
44
# File 'lib/rspec/conductor/util/terminal.rb', line 42

def line(content = "", truncate: true, redraw: true)
  Line.new(@terminal, content, truncate: truncate, redraw: redraw) { |l| @contents << l }
end

#linesObject



54
55
56
# File 'lib/rspec/conductor/util/terminal.rb', line 54

def lines
  @contents.flat_map(&:lines)
end

#puts(content = "", redraw: true) ⇒ Object



46
47
48
# File 'lib/rspec/conductor/util/terminal.rb', line 46

def puts(content = "", redraw: true)
  line(content, truncate: false, redraw: redraw)
end