Class: Pubid::Iala::Builder
- Inherits:
-
Object
- Object
- Pubid::Iala::Builder
- Defined in:
- lib/pubid/iala/builder.rb
Overview
Builds an IALA identifier object from the Parslet parse tree.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build(parsed) ⇒ Object
23 24 25 |
# File 'lib/pubid/iala/builder.rb', line 23 def self.build(parsed) new.build(parsed) end |
Instance Method Details
#build(parsed) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pubid/iala/builder.rb', line 7 def build(parsed) hash = parsed return build_annex(hash) if hash[:annex_marker] type_letter = stringify(hash[:type_letter])&.upcase attrs = { number: build_number(hash, type_letter), edition: stringify(hash.dig(:edition, :edition_value)), language: stringify(hash.dig(:language_group, :language))&.upcase, }.compact Iala.identifier_klass_for_type_letter(type_letter).new(**attrs) end |