Class: Pubid::Bsi::Identifiers::Section
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Identifier
- SingleIdentifier
- Pubid::Bsi::Identifiers::Section
- Defined in:
- lib/pubid/bsi/identifiers/section.rb
Overview
BSI Section Examples:
-
Colon format (DD): “DD 51:Section 0:1977”
-
Space format (BS): “BS 3224 Section B2:1970”
Constant Summary collapse
- TYPED_STAGES =
[ Pubid::Components::TypedStage.new( code: :pubsection, stage_code: :published, type_code: :section, abbr: ["Section"], name: "Section", harmonized_stages: %w[60.00 60.60], ), ].freeze
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from SingleIdentifier
Methods inherited from Identifier
#base_identifier, #eql?, #exclude, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
.type ⇒ Object
25 26 27 |
# File 'lib/pubid/bsi/identifiers/section.rb', line 25 def self.type { key: :section, title: "Section", short: "Section" } end |
Instance Method Details
#to_s(lang: :en, lang_single: false) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pubid/bsi/identifiers/section.rb', line 29 def to_s(lang: :en, lang_single: false) # Build string representation - Section has two formats parts = [] # Publisher (DD, BS, etc.) parts << publisher.to_s if publisher # Number if number number_str = number.is_a?(Components::Code) ? number.value.to_s : number.to_s parts << number_str end result = parts.join(" ") # Section suffix with colon or space format result += if section_format == "colon" ":Section #{section_id}" else " Section #{section_id}" end # Date if date year_val = date.is_a?(Components::Date) ? date.year : date.to_i result += ":#{year_val}" end result end |