Class: Pubid::Calconnect::Builder

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

Overview

Builds a CalConnect identifier object from a Parslet parse tree. There is a single concrete type (Identifiers::Standard), so no type dispatch.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(parsed_data) ⇒ Object



8
9
10
# File 'lib/pubid/calconnect/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
18
# File 'lib/pubid/calconnect/builder.rb', line 12

def build(data)
  Identifiers::Standard.new(
    series: data[:series]&.to_s,
    number: data[:number].to_s,
    date: build_date(data),
  )
end