Method: Traject::MarcExtractor#collect_matching_lines

Defined in:
lib/traject/marc_extractor.rb

#collect_matching_lines(marc_record) ⇒ Object

line each_matching_line, takes a block to process each matching line, but collects results of block into an array -- flattens any subarrays for you!

Useful for re-use of this class for custom processing

yields the MARC Field, the MarcExtractor::Spec object, the MarcExtractor object.



287
288
289
290
291
292
293
# File 'lib/traject/marc_extractor.rb', line 287

def collect_matching_lines(marc_record)
  results = []
  self.each_matching_line(marc_record) do |field, spec, extractor|
    results.concat [yield(field, spec, extractor)].flatten
  end
  return results
end