Class: Pubid::Ecma::UrnGenerator

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

Overview

Emits urn:ecma:<tag>:<number>[:part-<part>] where the tag is bare for standards, "tr" for technical reports and "mem" for mementos:

ECMA-411      -> urn:ecma:411
ECMA-418-1    -> urn:ecma:418:part-1
ECMA TR/101   -> urn:ecma:tr:101
ECMA MEM/1970 -> urn:ecma:mem:1970

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



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pubid/ecma/urn_generator.rb', line 12

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

  tag = identifier.type_prefix&.downcase
  parts << tag if tag

  parts << identifier.number.to_s
  parts << "part-#{identifier.part}" if identifier.part

  parts.join(":")
end