Class: IO::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/io/line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ioObject (readonly)

Returns the value of attribute io.



6
7
8
# File 'lib/io/line.rb', line 6

def io
  @io
end

Instance Method Details



12
13
14
# File 'lib/io/line.rb', line 12

def print(*strs)
  tap { @io.print(strs.join.gsub($/, "")) }
end

#endObject



16
17
18
# File 'lib/io/line.rb', line 16

def end
  tap { @io.print($/) }
end

#rewindObject



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