Class: Pubid::Jis::Builder

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(parsed_data) ⇒ Object



6
7
8
# File 'lib/pubid/jis/builder.rb', line 6

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

Instance Method Details

#build(data) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pubid/jis/builder.rb', line 10

def build(data)
  # Handle supplement case first; the SYMBOL clause (if any) attaches to
  # the outermost identifier, be it the base or the supplement.
  identifier = if data[:amendment]
                 build_amendment(data)
               elsif data[:explanation]
                 build_explanation(data)
               elsif data[:corrigendum]
                 build_corrigendum(data)
               else
                 build_single_identifier(data)
               end
  attach_symbol(identifier, data)
end