Class: Pubid::Jis::UrnGenerator

Inherits:
UrnGenerator::Base show all
Defined in:
lib/pubid/jis/urn_generator.rb

Instance Attribute Summary

Attributes inherited from UrnGenerator::Base

#identifier

Instance Method Summary collapse

Methods inherited from UrnGenerator::Base

#initialize, #maybe, #urn_edition, #urn_language, #urn_namespace, #urn_number, #urn_part, #urn_publisher, #urn_subpart, #urn_type, #urn_year

Constructor Details

This class inherits a constructor from Pubid::UrnGenerator::Base

Instance Method Details

#generateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pubid/jis/urn_generator.rb', line 6

def generate
  parts = ["urn", "jis"]

  parts << identifier.code.to_s if identifier.code

  parts << identifier.year.to_s if identifier.year

  parts << identifier.language.to_s.downcase if identifier.language

  parts << "all" if identifier.all_parts?

  if identifier.is_a?(SupplementIdentifier) && identifier.supplement_notation
    parts << identifier.supplement_notation.to_s.downcase
  end

  parts.join(":")
end