class NewspaperWorks::Ingest::BasePublicationInfo

Attributes

issn[RW]
lccn[RW]

Public Class Methods

new(lccn) click to toggle source
# File lib/newspaper_works/ingest/base_publication_info.rb, line 6
def initialize(lccn)
  @lccn = lccn
  load
end

Public Instance Methods

load() click to toggle source
# File lib/newspaper_works/ingest/base_publication_info.rb, line 11
def load
  raise NotImplementedError, "abstract"
end
oclc_prefixed(oclcnum) click to toggle source

Return normalized, prefixed OCLC number from numeric Integer or

String inputs; prefxes based on number of digits, leaves any
prefix in input unchanged.

@param oclcnum [String, Integer] prefixed or unprefixed OCLC control # @return [String] normalized, prefixed OCLC number

# File lib/newspaper_works/ingest/base_publication_info.rb, line 20
def oclc_prefixed(oclcnum)
  # unprefixed number, as string
  digits = oclcnum.to_s.gsub(/[A-Za-z]/, '')
  return "ocm#{digits}" if digits.size == 8
  return "ocn#{digits}" if digits.size == 9
  "on#{digits}"
end
place_name_from_title(title) click to toggle source
# File lib/newspaper_works/ingest/base_publication_info.rb, line 28
def place_name_from_title(title)
  parts = title.split(/ [\(]/)
  return if parts.size < 2
  parts[1].split(')')[0]
end