Class: Pubid::Ashrae::Identifier

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

Overview

Base class for all ASHRAE identifiers. Canonical name Pubid::Ashrae::Identifier; every concrete ASHRAE identifier descends from it, and Identifiers::Base — aliased at the foot of this file — points back to it.

Class 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, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

.parse(identifier) ⇒ Pubid::Ashrae::Identifier

Parse an ASHRAE identifier string into an identifier object

Parameters:

  • identifier (String)

    The ASHRAE identifier string to parse

Returns:

Raises:

  • (Parslet::ParseFailed)

    If parsing fails



14
15
16
17
18
19
# File 'lib/pubid/ashrae/identifiers/base.rb', line 14

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