Class: IO::Line

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

Constant Summary collapse

VERSION =
"0.1.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ioObject (readonly)

Returns the value of attribute io.



8
9
10
# File 'lib/io/line.rb', line 8

def io
  @io
end

Instance Method Details

#endObject



18
19
20
# File 'lib/io/line.rb', line 18

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


14
15
16
# File 'lib/io/line.rb', line 14

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

#rewindObject



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