Class: RSpec::Conductor::Util::Terminal::Line

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(terminal, content, truncate: true, redraw: true) {|_self| ... } ⇒ Line

Returns a new instance of Line.

Yields:

  • (_self)

Yield Parameters:



14
15
16
17
18
19
# File 'lib/rspec/conductor/util/terminal.rb', line 14

def initialize(terminal, content, truncate: true, redraw: true)
  @terminal = terminal
  @truncate = truncate
  yield self if block_given?
  update(content, redraw: redraw)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



12
13
14
# File 'lib/rspec/conductor/util/terminal.rb', line 12

def content
  @content
end

#truncateObject (readonly)

Returns the value of attribute truncate.



12
13
14
# File 'lib/rspec/conductor/util/terminal.rb', line 12

def truncate
  @truncate
end

Instance Method Details

#linesObject



30
31
32
# File 'lib/rspec/conductor/util/terminal.rb', line 30

def lines
  @content ? [self] : []
end

#to_sObject



26
27
28
# File 'lib/rspec/conductor/util/terminal.rb', line 26

def to_s
  @content
end

#update(new_content, redraw: true) ⇒ Object



21
22
23
24
# File 'lib/rspec/conductor/util/terminal.rb', line 21

def update(new_content, redraw: true)
  @content = new_content
  @terminal.redraw if redraw
end