Class: Abtab::Filter::Grep

Inherits:
Abtab::Filter show all
Defined in:
lib/abtab/filter/grep.rb

Instance Attribute Summary

Attributes inherited from Abtab::Filter

#driver

Instance Method Summary collapse

Methods inherited from Abtab::Filter

#initialize

Constructor Details

This class inherits a constructor from Abtab::Filter

Instance Method Details

#columnsObject



22
23
24
# File 'lib/abtab/filter/grep.rb', line 22

def columns
  @driver.columns
end

#filter_predicate=(p) ⇒ Object



6
7
8
# File 'lib/abtab/filter/grep.rb', line 6

def filter_predicate= p
  @filter = p
end

#next_recordObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/abtab/filter/grep.rb', line 10

def next_record
  rec = nil
  while rec = driver.next_record
    if @filter.call(rec)
      break
    else
      0
    end
  end
  return rec
end