Class: Clacky::UI2::OutputBuffer::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/clacky/ui2/output_buffer.rb

Overview

A single logical output entry.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Monotonic id, unique within the buffer



36
37
38
39
40
41
42
43
44
45
# File 'lib/clacky/ui2/output_buffer.rb', line 36

Entry = Struct.new(:id, :lines, :kind, :committed, keyword_init: true) do
  # Visual row count this entry occupies on screen (before it's committed)
  def height
    lines.length
  end

  def to_s
    lines.join("\n")
  end
end

#linesObject (readonly)

Rendered (already-wrapped) visual lines



36
37
38
39
40
41
42
43
44
45
# File 'lib/clacky/ui2/output_buffer.rb', line 36

Entry = Struct.new(:id, :lines, :kind, :committed, keyword_init: true) do
  # Visual row count this entry occupies on screen (before it's committed)
  def height
    lines.length
  end

  def to_s
    lines.join("\n")
  end
end

Instance Method Details

#committed=(value) ⇒ Object

True once pushed into terminal scrollback



36
37
38
39
40
41
42
43
44
45
# File 'lib/clacky/ui2/output_buffer.rb', line 36

Entry = Struct.new(:id, :lines, :kind, :committed, keyword_init: true) do
  # Visual row count this entry occupies on screen (before it's committed)
  def height
    lines.length
  end

  def to_s
    lines.join("\n")
  end
end

#heightObject

Visual row count this entry occupies on screen (before it’s committed)



38
39
40
# File 'lib/clacky/ui2/output_buffer.rb', line 38

def height
  lines.length
end

#kind=(value) ⇒ Object

:text | :progress | :system (hint for renderer)



36
37
38
39
40
41
42
43
44
45
# File 'lib/clacky/ui2/output_buffer.rb', line 36

Entry = Struct.new(:id, :lines, :kind, :committed, keyword_init: true) do
  # Visual row count this entry occupies on screen (before it's committed)
  def height
    lines.length
  end

  def to_s
    lines.join("\n")
  end
end

#to_sObject



42
43
44
# File 'lib/clacky/ui2/output_buffer.rb', line 42

def to_s
  lines.join("\n")
end