Class: Pubid::Jis::SingleIdentifier

Inherits:
Identifier show all
Defined in:
lib/pubid/jis/single_identifier.rb

Overview

Base class for single (non-supplement) JIS identifiers Includes: JapaneseIndustrialStandard, TechnicalReport, TechnicalSpecification

Constant Summary collapse

TYPE_CLASSES =

Type prefix to identifier class mapping

{
  "TR" => "TechnicalReport",
  "TS" => "TechnicalSpecification",
  nil => "JapaneseIndustrialStandard", # Default
}.freeze

Constants inherited from Identifier

Identifier::JIS_TYPE_MAP, Identifier::PUBLISHER

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Identifier

#==, #all_parts?, #code, 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 Attribute Details

#with_publisherObject (readonly)

Returns the value of attribute with_publisher.



15
16
17
# File 'lib/pubid/jis/single_identifier.rb', line 15

def with_publisher
  @with_publisher
end

Class Method Details

.identifier_class_for_type(type) ⇒ Object

Determine identifier class from type prefix



18
19
20
21
22
23
# File 'lib/pubid/jis/single_identifier.rb', line 18

def self.identifier_class_for_type(type)
  class_name = TYPE_CLASSES[type]
  return nil unless class_name

  Identifiers.const_get(class_name)
end

Instance Method Details

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



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

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