Module: Pubid::Gost
- Extended by:
- PrefixesSupport
- Defined in:
- lib/pubid/gost.rb,
lib/pubid/gost/parser.rb,
lib/pubid/gost/builder.rb,
lib/pubid/gost/renderer.rb,
lib/pubid/gost/identifier.rb,
lib/pubid/gost/urn_parser.rb,
lib/pubid/gost/identifiers.rb,
lib/pubid/gost/urn_generator.rb,
lib/pubid/gost/identifiers/harmonized.rb,
lib/pubid/gost/identifiers/foreign_reference.rb,
lib/pubid/gost/identifiers/national_standard.rb,
lib/pubid/gost/identifiers/identical_adoption.rb,
lib/pubid/gost/identifiers/interstate_standard.rb
Defined Under Namespace
Modules: Identifiers Classes: Builder, Identifier, Parser, Renderer, UrnGenerator, UrnParser
Constant Summary collapse
- PREFIXES =
Leading identifier tokens that a GOST document id can start with. Latin "GOST" and Cyrillic "ГОСТ" are both official; "R" (Russian national, e.g. "GOST R 34.12-2015") routes to this flavor too.
["GOST", "ГОСТ"].freeze
Class Method Summary collapse
-
.identifier_types ⇒ Array<Class>
Auto-discover identifier types from the Identifiers namespace.
-
.locate_type(code) ⇒ Class?
Lookup: type key → identifier class.
-
.parse(identifier) ⇒ Pubid::Gost::Identifier
Parse a GOST identifier string into an identifier object.
Methods included from PrefixesSupport
Class Method Details
.identifier_types ⇒ Array<Class>
Auto-discover identifier types from the Identifiers namespace.
33 34 35 36 37 38 |
# File 'lib/pubid/gost.rb', line 33 def self.identifier_types @identifier_types ||= Identifiers.constants .filter_map { |c| begin; Identifiers.const_get(c); rescue NameError; nil; end } .select { |c| c.is_a?(Class) && c < Pubid::Identifier } .reject { |c| c == Identifier } end |
.locate_type(code) ⇒ Class?
Lookup: type key → identifier class
43 44 45 |
# File 'lib/pubid/gost.rb', line 43 def self.locate_type(code) identifier_types.find { |t| t.type[:key].to_s == code.to_s } end |
.parse(identifier) ⇒ Pubid::Gost::Identifier
Parse a GOST identifier string into an identifier object.
23 24 25 |
# File 'lib/pubid/gost.rb', line 23 def self.parse(identifier) Identifier.parse(identifier) end |