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.


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

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

Instance Method Details

#eachObject


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

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

#getsObject


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

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