Class: Pubid::Etsi::Identifiers::Base

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

Overview

Base class for all ETSI identifiers

Direct Known Subclasses

EtsiStandard, SupplementIdentifier

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

Constructor Details

This class inherits a constructor from Pubid::Identifier

Instance Method Details

#==(other) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/pubid/etsi/identifiers/base.rb', line 27

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

  type == other.type &&
    code == other.code &&
    version == other.version &&
    date == other.date
end

#publisherObject



16
17
18
# File 'lib/pubid/etsi/identifiers/base.rb', line 16

def publisher
  "ETSI"
end

#to_sObject



20
21
22
23
24
25
# File 'lib/pubid/etsi/identifiers/base.rb', line 20

def to_s
  result = "#{publisher} #{type} #{code}"
  result += " #{version} (#{date.year}-#{date.month.to_s.rjust(2,
                                                               '0')})"
  result
end

#typeString

Generate URN for this identifier

Returns:

  • (String)

    URN representation



11
# File 'lib/pubid/etsi/identifiers/base.rb', line 11

attribute :type, :string