Class: Fir::Eraser
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(output) ⇒ Eraser
constructor
A new instance of Eraser.
- #perform(state) ⇒ Object
Methods included from ScreenHelper
#clear, #cursor_back, #horizontal_absolute, #line_prompt, #next_line, #previous_line
Constructor Details
#initialize(output) ⇒ Eraser
Returns a new instance of Eraser.
12 13 14 |
# File 'lib/fir/eraser.rb', line 12 def initialize(output) @output = output end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/fir/eraser.rb', line 10 def output @output end |
Instance Method Details
#perform(state) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fir/eraser.rb', line 16 def perform(state) state.lines.length.times do |i| output.syswrite("#{horizontal_absolute(1)}#{clear(0)}") output.syswrite("#{previous_line(1)}#{clear(0)}") unless i.zero? end end |