Class: Pubid::Iana::Builder

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

Overview

Builds an IANA identifier object from a parse tree. There is a single concrete type (Registry), so the builder just extracts the slug fields.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(parsed_data) ⇒ Object



8
9
10
# File 'lib/pubid/iana/builder.rb', line 8

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

Instance Method Details

#build(data) ⇒ Object



12
13
14
15
16
17
# File 'lib/pubid/iana/builder.rb', line 12

def build(data)
  Identifiers::Registry.new(
    registry: data[:registry].to_s,
    sub_registry: data[:sub_registry]&.to_s,
  )
end