Class: Sus::Output::Lines
- Inherits:
-
Object
- Object
- Sus::Output::Lines
- Defined in:
- lib/sus/output/lines.rb
Instance Method Summary collapse
- #[]=(index, line) ⇒ Object
- #clear ⇒ Object
- #height ⇒ Object
-
#initialize(output) ⇒ Lines
constructor
A new instance of Lines.
- #redraw(index) ⇒ Object
Constructor Details
#initialize(output) ⇒ Lines
Returns a new instance of Lines.
11 12 13 14 15 16 |
# File 'lib/sus/output/lines.rb', line 11 def initialize(output) @output = output @lines = [] @current_count = 0 end |
Instance Method Details
#[]=(index, line) ⇒ Object
22 23 24 25 26 |
# File 'lib/sus/output/lines.rb', line 22 def []= index, line @lines[index] = line redraw(index) end |
#clear ⇒ Object
28 29 30 31 |
# File 'lib/sus/output/lines.rb', line 28 def clear @lines.clear write end |
#height ⇒ Object
18 19 20 |
# File 'lib/sus/output/lines.rb', line 18 def height @output.size.first end |
#redraw(index) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/sus/output/lines.rb', line 33 def redraw(index) if index < @current_count update(index, @lines[index]) else write end end |