Class: Rblock::Logfile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ Logfile

Returns a new instance of Logfile.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rblock/logfile.rb', line 5

def initialize(file_name)
  @line = nil

  FileUtils.touch(file_name)
  @file = File.new(file_name)

  while @file.gets
    # do nothing, just wait to get to end of log file
  end

  self
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



3
4
5
# File 'lib/rblock/logfile.rb', line 3

def line
  @line
end

Instance Method Details

#getsObject



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

def gets
  @line = @file.gets
end