Class: Pubid::Sae::Identifier

Inherits:
Identifier
  • Object
show all
Defined in:
lib/pubid/sae/identifiers/base.rb

Overview

Base SAE Identifier. Canonical name Pubid::Sae::Identifier (Identifiers::Base is a back-compat alias). SAE has a single identifier class that IS the document type, so this class is both the base and the only concrete type. Handles all SAE document types (AMS, AIR, ARP, AS, MA).

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Identifier

#base_identifier, #eql?, #exclude, from_hash, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #render, #resolve_urn_generator, #root, #to_hash, #to_mr_string, #to_s, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

.parse(input) ⇒ Object



10
11
12
13
14
15
# File 'lib/pubid/sae/identifiers/base.rb', line 10

def self.parse(input)
  parsed = Parser.parse(input)
  Builder.build(parsed)
rescue Parslet::ParseFailed => e
  raise "Failed to parse SAE identifier: #{input}\n#{e.message}"
end

.typeObject



22
23
24
# File 'lib/pubid/sae/identifiers/base.rb', line 22

def self.type
  { key: :base, web: :standard, title: "Standard", short: "SAE" }
end

Instance Method Details

#yearObject



26
27
28
# File 'lib/pubid/sae/identifiers/base.rb', line 26

def year
  date&.year
end