Class: BitClust::LineFilter

Inherits:
Object show all
Includes:
ParseUtils, Enumerable
Defined in:
lib/bitclust/preprocessor.rb

Overview

Superclass of Preprocessor

Direct Known Subclasses

LineCollector, Preprocessor

Instance Method Summary collapse

Methods included from ParseUtils

#parse_error

Constructor Details

#initialize(f) ⇒ LineFilter

Returns a new instance of LineFilter.



23
24
25
26
# File 'lib/bitclust/preprocessor.rb', line 23

def initialize(f)
  @f = f
  @buf = []
end

Instance Method Details

#eachObject



32
33
34
35
36
# File 'lib/bitclust/preprocessor.rb', line 32

def each
  while line = gets()
    yield line
  end
end

#getsObject



28
29
30
# File 'lib/bitclust/preprocessor.rb', line 28

def gets
  @buf.shift || next_line(@f)
end