Class: Sus::Output::Lines

Inherits:
Object
  • Object
show all
Defined in:
lib/sus/output/lines.rb

Instance Method Summary collapse

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

#clearObject



28
29
30
31
# File 'lib/sus/output/lines.rb', line 28

def clear
	@lines.clear
	write
end

#heightObject



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