Class: IO::Line
- Inherits:
-
Object
- Object
- IO::Line
- Defined in:
- lib/io/line.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io) ⇒ Line
constructor
A new instance of Line.
-
#print(*strs) ⇒ Object
-
#end ⇒ Object
-
#rewind ⇒ Object
Constructor Details
#initialize(io) ⇒ Line
Returns a new instance of Line.
8 9 10 |
# File 'lib/io/line.rb', line 8 def initialize(io) @io = io end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
6 7 8 |
# File 'lib/io/line.rb', line 6 def io @io end |
Instance Method Details
#print(*strs) ⇒ Object
12 13 14 |
# File 'lib/io/line.rb', line 12 def print(*strs) tap { @io.print(strs.join.gsub($/, "")) } end |
#end ⇒ Object
16 17 18 |
# File 'lib/io/line.rb', line 16 def end tap { @io.print($/) } end |
#rewind ⇒ Object
20 21 22 23 24 25 |
# File 'lib/io/line.rb', line 20 def rewind tap do @io.erase_line(2) @io.goto_column(0) end end |