Class: Pubid::Jcgm::Identifiers::Meeting

Inherits:
SingleIdentifier show all
Defined in:
lib/pubid/jcgm/identifiers/meeting.rb

Overview

A JCGM committee/meeting record, e.g. "JCGM 17th Meeting (2012)".

number (Components::Code) holds the meeting ordinal as a clean integer value ("17"); date (Components::Date, year-only) holds the year.

Constant Summary collapse

TYPED_STAGES =
[
  Pubid::Components::TypedStage.new(
    code: :pubmeeting,
    stage_code: :published,
    type_code: :jcgm_meeting,
    abbr: ["Meeting"],
    name: "Meeting",
    harmonized_stages: %w[60.00 60.60],
  ),
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SingleIdentifier

#build_code, #date_for, #day_from_kv, #day_to_kv, default_publisher, #emit_kv, #language_portion, #month_from_kv, #month_to_kv, #number_from_kv, #number_portion, #number_to_kv, published_typed_stage, #publisher_portion, #stage, #type, #year_from_kv, #year_to_kv

Methods inherited from Pubid::Jcgm::Identifier

parse

Methods inherited from Identifier

apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, 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

.ordinal(number) ⇒ Object

Ordinal suffix as printed by the JCGM/BIPM data generator: a naive last-digit rule (1->st, 2->nd, 3->rd, else th) with NO 11/12/13 teens exception. The real records print "11st", "12nd", "13rd", so applying the standard-English teens exception would break round-trip.



30
31
32
33
34
35
36
37
38
39
# File 'lib/pubid/jcgm/identifiers/meeting.rb', line 30

def self.ordinal(number)
  n = number.to_i
  suffix = case n % 10
           when 1 then "st"
           when 2 then "nd"
           when 3 then "rd"
           else "th"
           end
  "#{n}#{suffix}"
end

.typeObject



22
23
24
# File 'lib/pubid/jcgm/identifiers/meeting.rb', line 22

def self.type
  { key: :jcgm_meeting, title: "Meeting" }
end

Instance Method Details

#ordinalObject



41
42
43
# File 'lib/pubid/jcgm/identifiers/meeting.rb', line 41

def ordinal
  self.class.ordinal(number&.value)
end