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