Class: Pubid::Jis::SupplementIdentifier

Inherits:
SingleIdentifier show all
Defined in:
lib/pubid/jis/supplement_identifier.rb

Overview

Base class for supplement identifiers (Amendment, Explanation) Supplements are modifications to base documents

Constant Summary

Constants inherited from SingleIdentifier

Pubid::Jis::SingleIdentifier::TYPE_CLASSES

Constants inherited from Identifier

Identifier::JIS_TYPE_MAP, Identifier::PUBLISHER

Instance Attribute Summary

Attributes inherited from SingleIdentifier

#with_publisher

Instance Method Summary collapse

Methods inherited from SingleIdentifier

identifier_class_for_type

Methods inherited from Identifier

#all_parts?, from_hash, parse, #reaffirmed?, #symbol_suffix, #year_with_reaffirmation

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



40
41
42
43
44
45
46
47
# File 'lib/pubid/jis/supplement_identifier.rb', line 40

def ==(other)
  return false unless other.is_a?(SupplementIdentifier)
  return false unless other.class == self.class

  base == other.base &&
    number == other.number &&
    year == other.year
end

#codeObject

Inherit the rendered code from the base document.



25
26
27
# File 'lib/pubid/jis/supplement_identifier.rb', line 25

def code
  base&.code
end

#supplement_notationObject

Override in subclasses

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/pubid/jis/supplement_identifier.rb', line 36

def supplement_notation
  raise NotImplementedError, "Subclass must implement supplement_notation"
end

#to_s(with_publisher: true, **opts) ⇒ Object

Render as base + supplement notation



30
31
32
33
# File 'lib/pubid/jis/supplement_identifier.rb', line 30

def to_s(with_publisher: true, **opts)
  @with_publisher = with_publisher
  render(format: :human, **opts)
end