Class: BitClust::LineStream

Inherits:
Object show all
Defined in:
lib/bitclust/parseutils.rb

Overview

Provides line-wise access to a file with :file and :line. Used by Preprocessor

Instance Method Summary collapse

Constructor Details

#initialize(f) ⇒ LineStream

Returns a new instance of LineStream.



22
23
24
# File 'lib/bitclust/parseutils.rb', line 22

def initialize(f)
  @f = f
end

Instance Method Details

#getsObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bitclust/parseutils.rb', line 26

def gets
  line = @f.gets
  return nil unless line
  if @f.respond_to?(:path)
    path = @f.path
  else
    path = nil
  end
  line.location = Location.new(path, @f.lineno)
  line
end