Class: Pubid::Ashrae::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Ashrae::Identifier
- 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.
Direct Known Subclasses
Class Method Summary collapse
-
.parse(identifier) ⇒ Pubid::Ashrae::Identifier
Parse an ASHRAE identifier string into an identifier object.
Instance Method Summary collapse
-
#exclude(*args) ⇒ Object
ASHRAE stores the publication year in a plain :string scalar, not a Components::Date, so the base #exclude's :year->:date remap cannot nil it.
Methods inherited from Identifier
apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_s, #to_slug, #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
12 13 14 15 16 17 |
# File 'lib/pubid/ashrae/identifiers/base.rb', line 12 def self.parse(identifier) parsed = Parser.parse(identifier) Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse ASHRAE identifier '#{identifier}': #{e.}" end |
Instance Method Details
#exclude(*args) ⇒ Object
ASHRAE stores the publication year in a plain :string scalar, not a
Components::Date, so the base #exclude's :year->:date remap cannot nil
it. Reset the scalar directly (mirroring CSA/BIPM) so a year-less
partial reference is a year wildcard under
matches?(other, ignore: [:year]). super still recurses into the nested
base of wrapper types (Errata/Addendum/…), which carry no year scalar.
34 35 36 37 38 39 |
# File 'lib/pubid/ashrae/identifiers/base.rb', line 34 def exclude(*args) result = super year_keys = args & %i[year date] result.year = nil if !year_keys.empty? && result.respond_to?(:year=) result end |