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.



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

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

Instance Method Details

#eachObject



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

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

#getsObject



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

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