Class: Pubid::Adobe::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/pubid/adobe/builder.rb

Overview

Builds an Adobe identifier object from the Parslet parse tree.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(parsed) ⇒ Object



16
17
18
# File 'lib/pubid/adobe/builder.rb', line 16

def self.build(parsed)
  new.build(parsed)
end

Instance Method Details

#build(parsed) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
# File 'lib/pubid/adobe/builder.rb', line 7

def build(parsed)
  return build_tech_note(parsed[:tech_note]) if parsed[:tech_note]
  return build_tech_note_bare(parsed[:tech_note_bare]) if parsed[:tech_note_bare]
  return build_publication_version(parsed[:publication_version]) if parsed[:publication_version]
  return build_publication(parsed[:slug]) if parsed[:slug]

  raise ArgumentError, "Unrecognized Adobe parse tree: #{parsed.inspect}"
end