Module: Pubid::Ashrae::Identifier
- Defined in:
- lib/pubid/ashrae/identifier.rb
Constant Summary collapse
- TYPE_KEY_TO_KLASS =
Factory that builds an ASHRAE identifier from a hash of primitives. Dispatch on ‘:type` to the matching subclass; default is Pubid::Ashrae::Identifiers::Standard.
{ standard: "Standard", guideline: "Guideline", addendum: "Addendum", addenda_package: "AddendaPackage", combined_addenda: "CombinedAddenda", errata: "Errata", interpretation: "Interpretation", }.freeze
Class Method Summary collapse
- .create(type: nil, **opts) ⇒ Object
-
.parse(identifier) ⇒ Identifiers::Base
Parse an ASHRAE identifier string into an identifier object.
Class Method Details
.create(type: nil, **opts) ⇒ Object
30 31 32 33 |
# File 'lib/pubid/ashrae/identifier.rb', line 30 def self.create(type: nil, **opts) klass = resolve_create_class(type) klass.new(**coerce_create_attrs(opts)) end |
.parse(identifier) ⇒ Identifiers::Base
Parse an ASHRAE identifier string into an identifier object
10 11 12 13 14 15 |
# File 'lib/pubid/ashrae/identifier.rb', line 10 def self.parse(identifier) parsed = Parser.parse(identifier) Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse ASHRAE identifier '#{identifier}': #{e.}" end |