Module: Pubid::Un
- Extended by:
- PrefixesSupport
- Defined in:
- lib/pubid/un.rb,
lib/pubid/un/parser.rb,
lib/pubid/un/builder.rb,
lib/pubid/un/renderer.rb,
lib/pubid/un/identifier.rb,
lib/pubid/un/identifiers.rb,
lib/pubid/un/identifiers/document.rb
Defined Under Namespace
Modules: Identifiers
Classes: Builder, Identifier, Parser, Renderer
Constant Summary
collapse
- PREFIXES =
["UN"].freeze
Class Method Summary
collapse
prefix_flavor_key, prefixes
Class Method Details
.all_typed_stages ⇒ Object
29
30
31
32
33
|
# File 'lib/pubid/un.rb', line 29
def self.all_typed_stages
@all_typed_stages ||= identifier_types.flat_map do |klass|
klass.const_defined?(:TYPED_STAGES) ? klass.const_get(:TYPED_STAGES) : []
end
end
|
.identifier_types ⇒ Object
22
23
24
25
26
27
|
# File 'lib/pubid/un.rb', line 22
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.singleton_methods(false).include?(:type) }
.select { |c| c.type.is_a?(Hash) }
end
|
.locate_stage(abbr) ⇒ Object
39
40
41
42
|
# File 'lib/pubid/un.rb', line 39
def self.locate_stage(abbr)
abbr_str = abbr.to_s.upcase
all_typed_stages.find { |s| s.abbr.any? { |a| a.to_s.upcase == abbr_str } }
end
|
.locate_type(code) ⇒ Object
35
36
37
|
# File 'lib/pubid/un.rb', line 35
def self.locate_type(code)
identifier_types.find { |t| t.type[:key].to_s == code.to_s }
end
|
.parse(identifier) ⇒ Object
15
16
17
|
# File 'lib/pubid/un.rb', line 15
def self.parse(identifier)
Identifier.parse(identifier)
end
|