Class: Pubid::Amca::Identifiers::Base

Inherits:
Identifier
  • Object
show all
Defined in:
lib/pubid/amca/identifiers/base.rb

Overview

Base identifier class for ACMA identifiers Single Responsibility: Common functionality for all ACMA identifier types

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Identifier

#base_identifier, #eql?, #exclude, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_s, #to_supplement_s, #urn_supplement_type, #urn_type_code, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

.parse(string) ⇒ Object



28
29
30
# File 'lib/pubid/amca/identifiers/base.rb', line 28

def self.parse(string)
  Amca::Identifier.parse(string)
end

Instance Method Details

#base_hashObject

Override base_hash to handle AMCA-specific copublisher format (string, not array)



10
11
12
13
14
15
# File 'lib/pubid/amca/identifiers/base.rb', line 10

def base_hash
  hash = super
  # AMCA's copublisher is a string, not an array, so remove it from copublishers
  hash.delete(:copublishers) if hash[:copublishers]
  hash
end

#publisherObject

AMCA uses a fixed publisher string



24
25
26
# File 'lib/pubid/amca/identifiers/base.rb', line 24

def publisher
  "AMCA"
end

#to_urnObject



32
33
34
# File 'lib/pubid/amca/identifiers/base.rb', line 32

def to_urn
  UrnGenerator.new(self).generate
end