Method: Traject::MarcExtractor#each_matching_line

Defined in:
lib/traject/marc_extractor.rb

#each_matching_line(marc_record) ⇒ Object

Yields a block for every line in source record that matches spec. First arg to block is MARC::DataField or ControlField, second is the MarcExtractor::Spec that it matched on. May take account of options such as :alternate_script

Third (optional) arg to block is self, the MarcExtractor object, useful for custom implementations.



267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/traject/marc_extractor.rb', line 267

def each_matching_line(marc_record)
  marc_record.fields(@interesting_tags_hash.keys).each do |field|

    # Make sure it matches indicators too, specs_covering_field
    # doesn't check that.
    specs_covering_field(field).each do |spec|
      if spec.matches_indicators?(field)
        yield(field, spec, self)
      end
    end

  end
end