Class: SimpleWriter

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

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ SimpleWriter

Returns a new instance of SimpleWriter.



2
3
4
# File 'lib/simple_writer.rb', line 2

def initialize(path)
  @file = File.open(path, 'w')
end

Instance Method Details

#closeObject



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

def close
  @file.close
end

#posObject



10
11
12
# File 'lib/simple_writer.rb', line 10

def pos
  @file.pos
end

#rewindObject



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

def rewind
  @file.rewind
end

#write_line(line) ⇒ Object



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

def write_line(line)
  @file.print(line)
end