Class: Pubid::CenCenelec::Identifiers::Base

Inherits:
Identifier
  • Object
show all
Includes:
Pubid::CenCenelec::Identifier
Defined in:
lib/pubid/cen_cenelec/identifiers/base.rb

Overview

Base CEN identifier Format: PUBLISHER NUMBER:YEAR

Instance Method Summary collapse

Methods included from Pubid::CenCenelec::Identifier

parse

Methods included from IdentifierFacade

#from_hash, #polymorphic_type_map

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_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Instance Method Details

#==(other) ⇒ Object



30
31
32
33
34
35
# File 'lib/pubid/cen_cenelec/identifiers/base.rb', line 30

def ==(other)
  return false unless other.is_a?(Base)

  publisher == other.publisher && number == other.number &&
    parts == other.parts && year == other.year
end

#publisherString

Generate URN for this identifier

Returns:

  • (String)

    URN representation



16
# File 'lib/pubid/cen_cenelec/identifiers/base.rb', line 16

attribute :publisher, :string, collection: true

#to_s(**opts) ⇒ Object



26
27
28
# File 'lib/pubid/cen_cenelec/identifiers/base.rb', line 26

def to_s(**opts)
  render(format: :human, **opts)
end