Class: IO::Line::Multiple
- Inherits:
-
Object
- Object
- IO::Line::Multiple
- Defined in:
- lib/io/line/multiple.rb
Instance Method Summary collapse
-
#initialize(lines, cursor) ⇒ Multiple
constructor
A new instance of Multiple.
- #print(*strs, lineno:) ⇒ Object
Constructor Details
#initialize(lines, cursor) ⇒ Multiple
Returns a new instance of Multiple.
4 5 6 7 |
# File 'lib/io/line/multiple.rb', line 4 def initialize(lines, cursor) @lines = lines @cursor = cursor end |
Instance Method Details
#print(*strs, lineno:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/io/line/multiple.rb', line 9 def print(*strs, lineno:) line = @lines[lineno] if lineno > @cursor line.io.cursor_down(lineno - @cursor) elsif lineno < @cursor line.io.cursor_up(lineno + @cursor) end @cursor = lineno line.rewind.print(*strs) end |