Class: Pubid::Ietf::Builder

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

Overview

Turns the Parser's parse tree into a concrete identifier object, choosing the class from which fields are present.

Constant Summary collapse

SUBSERIES_CLASSES =
{
  "BCP" => "Bcp",
  "STD" => "Std",
  "FYI" => "Fyi",
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(parsed_data) ⇒ Object



14
15
16
# File 'lib/pubid/ietf/builder.rb', line 14

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

Instance Method Details

#build(data) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/pubid/ietf/builder.rb', line 18

def build(data)
  if data.key?(:draft_rest)
    build_draft(data)
  elsif data[:series]
    build_subseries(data)
  else
    build_rfc(data)
  end
end