Class: Pubid::Bsi::Identifiers::Index
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Identifier
- SingleIdentifier
- Pubid::Bsi::Identifiers::Index
- Defined in:
- lib/pubid/bsi/identifiers/index.rb
Overview
BSI Index Examples: “BS 5000:Index:1981”, “BS 185 Index:1964”, “BS 5000 Index Issue 4:1980”
Constant Summary collapse
- TYPED_STAGES =
[ Pubid::Components::TypedStage.new( code: :index, stage_code: :published, type_code: :index, abbr: ["Index"], name: "Index", 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
23 24 25 |
# File 'lib/pubid/bsi/identifiers/index.rb', line 23 def self.type { key: :index, title: "Index", short: "Index" } end |
Instance Method Details
#to_s(lang: :en, lang_single: false) ⇒ Object
27 28 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/index.rb', line 27 def to_s(lang: :en, lang_single: false) # Build string representation - Index has special format parts = [] # Publisher (BS) 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(" ") # Index suffix with colon or space format result += if issue_number " Index Issue #{issue_number}" elsif index_format == "colon" ":Index" else " Index" end # Date if date year_val = date.is_a?(Components::Date) ? date.year : date.to_i result += ":#{year_val}" end result end |