Class: Pubid::Iala::UrnGenerator
- Inherits:
-
Object
- Object
- Pubid::Iala::UrnGenerator
- Defined in:
- lib/pubid/iala/urn_generator.rb
Overview
Generates URN strings for IALA identifiers using the Maritime Resource Name (MRN) namespace that IALA prints on its cover pages.
Format: urn:mrn:iala:pub:
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(identifier) ⇒ UrnGenerator
constructor
A new instance of UrnGenerator.
Constructor Details
#initialize(identifier) ⇒ UrnGenerator
Returns a new instance of UrnGenerator.
14 15 16 |
# File 'lib/pubid/iala/urn_generator.rb', line 14 def initialize(identifier) @identifier = identifier end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
12 13 14 |
# File 'lib/pubid/iala/urn_generator.rb', line 12 def identifier @identifier end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/pubid/iala/urn_generator.rb', line 18 def generate return generate_annex if identifier.is_a?(Identifiers::Annex) parts = ["urn:mrn:iala:pub", code_segment] parts << "ed#{identifier.edition}" if identifier.edition parts << identifier.language.downcase if identifier.language parts.join(":") end |