Class: Pubid::W3c::UrnGenerator

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

Overview

Emits urn:w3c:<type-down>:<code>[:<date>], e.g. "W3C WD-charmod-19991129" -> "urn:w3c:wd:charmod:19991129" "W3C 2dcontext" -> "urn:w3c:2dcontext"

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



9
10
11
12
13
14
15
# File 'lib/pubid/w3c/urn_generator.rb', line 9

def generate
  parts = ["urn", "w3c"]
  parts << identifier.type_prefix.downcase if identifier.type_prefix
  parts << identifier.code.to_s
  parts << identifier.date.to_s if identifier.date
  parts.join(":")
end