Module: Pubid::Adobe
- Extended by:
- PrefixesSupport
- Defined in:
- lib/pubid/adobe.rb,
lib/pubid/adobe/parser.rb,
lib/pubid/adobe/builder.rb,
lib/pubid/adobe/renderer.rb,
lib/pubid/adobe/identifier.rb,
lib/pubid/adobe/urn_parser.rb,
lib/pubid/adobe/identifiers.rb,
lib/pubid/adobe/urn_generator.rb,
lib/pubid/adobe/identifiers/tech_note.rb,
lib/pubid/adobe/identifiers/publication.rb
Defined Under Namespace
Modules: Identifiers Classes: Builder, Identifier, Parser, Renderer, UrnGenerator, UrnParser
Constant Summary collapse
- PREFIXES =
Leading identifier prefix tokens that an Adobe document id can start with. Tech notes appear as both
Adobe Technical Note #<n>and the short aliasATN<n>in citations; both must route to this flavor. Named publications start withAdobe(e.g.Adobe Glyph List,Adobe-Japan1-7). ["Adobe", "ATN"].freeze
Class Method Summary collapse
-
.identifier_klass_for_short(short) ⇒ Class<Identifier>
Lookup: type short letter (e.g. "ATN") → identifier class.
-
.identifier_types ⇒ Array<Class>
Auto-discover identifier types from the Identifiers namespace.
-
.locate_type(code) ⇒ Class?
Lookup: type key → identifier class.
-
.parse(identifier) ⇒ Pubid::Adobe::Identifier
Parse an Adobe identifier string into an identifier object.
Methods included from PrefixesSupport
Class Method Details
.identifier_klass_for_short(short) ⇒ Class<Identifier>
Lookup: type short letter (e.g. "ATN") → identifier class
53 54 55 56 |
# File 'lib/pubid/adobe.rb', line 53 def self.identifier_klass_for_short(short) @by_short ||= identifier_types.to_h { |klass| [klass.type[:short].to_s, klass] } @by_short.fetch(short.to_s) end |
.identifier_types ⇒ Array<Class>
Auto-discover identifier types from the Identifiers namespace.
36 37 38 39 40 41 |
# File 'lib/pubid/adobe.rb', line 36 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
46 47 48 |
# File 'lib/pubid/adobe.rb', line 46 def self.locate_type(code) identifier_types.find { |t| t.type[:key].to_s == code.to_s } end |
.parse(identifier) ⇒ Pubid::Adobe::Identifier
Parse an Adobe identifier string into an identifier object.
25 26 27 |
# File 'lib/pubid/adobe.rb', line 25 def self.parse(identifier) Identifier.parse(identifier) end |