lib/psulib_traject/macros.rb
def process_publication_date
      lambda do |record, accumulator|
        return nil unless record.is_a? MARC::Record

        processor = Processors::PubDate.new

        field008 = Traject::MarcExtractor.cached('008').extract(record).first
        pub_date = processor.find_date(field008)

        if pub_date.nil?
          # Nothing from 008, try 264 and 260
          field264c = Traject::MarcExtractor.cached('264|*1|c', separator: nil).extract(record).first
          field260c = Traject::MarcExtractor.cached('260c', separator: nil).extract(record).first
          pub_date = processor.check_elsewhere field264c, field260c
        end

        publication_date = pub_date_in_range(pub_date)
        accumulator << publication_date if publication_date
      end
    end
# Feed the record to the MarcPubDateProcessor class to find the publication year.
#
# Refactor of Traject::Macros::Marc21Semantics#marc_publication_date as the basic logic but check for 264|*1|c before
# 260c.
Feed the record to the MarcPubDateProcessor class to find the publication year.
Refactor of Traject::Macros::Marc21Semantics#marc_publication_date as the basic logic but check for 264|*1|c before
260c.
Feed the record to the MarcPubDateProcessor class to find the publication year . Refactor of Traject :: Macros :: Marc21Semantics#marc_publication_date as the basic logic but check for 264| * 1|c before 260c .
def process_publication_date
      lambda do |record, accumulator|
        return nil unless record.is_a? MARC::Record
        processor = Processors::PubDate.new
        field008 = Traject::MarcExtractor.cached('008').extract(record).first
        pub_date = processor.find_date(field008)
        if pub_date.nil?
          field264c = Traject::MarcExtractor.cached('264|*1|c', separator: nil).extract(record).first
          field260c = Traject::MarcExtractor.cached('260c', separator: nil).extract(record).first
          pub_date = processor.check_elsewhere field264c, field260c
        end
        publication_date = pub_date_in_range(pub_date)
        accumulator << publication_date if publication_date
      end
    end
def process_publication_date lambda do | record , accumulator | return nil unless record . is_a? MARC :: Record processor = Processors :: PubDate . new field008 = Traject :: MarcExtractor . cached ( '008' ) . extract ( record ) . first pub_date = processor . find_date ( field008 ) if pub_date . nil? field264c = Traject :: MarcExtractor . cached ( '264|*1|c' , separator : nil ) . extract ( record ) . first field260c = Traject :: MarcExtractor . cached ( '260c' , separator : nil ) . extract ( record ) . first pub_date = processor . check_elsewhere field264c , field260c end publication_date = pub_date_in_range ( pub_date ) accumulator << publication_date if publication_date end end
Feed the record to the MarcPubDateProcessor class to find the publication year.
Feed the record to the MarcPubDateProcessor class to find the publication year .
# Nothing from 008, try 264 and 260