Class: Pubid::Jis::SingleIdentifier
- Inherits:
-
Identifiers::Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Identifiers::Base
- Pubid::Jis::SingleIdentifier
- Defined in:
- lib/pubid/jis/single_identifier.rb
Overview
Base class for single (non-supplement) JIS identifiers Includes: JapaneseIndustrialStandard, TechnicalReport, TechnicalSpecification
Direct Known Subclasses
Identifiers::JapaneseIndustrialStandard, Identifiers::Standard, Identifiers::TechnicalReport, Identifiers::TechnicalSpecification
Constant Summary collapse
- TYPE_CLASSES =
Type prefix to identifier class mapping
{ "TR" => "TechnicalReport", "TS" => "TechnicalSpecification", nil => "JapaneseIndustrialStandard", # Default }.freeze
Class Method Summary collapse
-
.identifier_class_for_type(type) ⇒ Object
Determine identifier class from type prefix.
Instance Method Summary collapse
Methods inherited from Identifiers::Base
#==, #all_parts?, #code, #initialize, #publisher
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::Jis::Identifiers::Base
Class Method Details
.identifier_class_for_type(type) ⇒ Object
Determine identifier class from type prefix
16 17 18 19 20 21 |
# File 'lib/pubid/jis/single_identifier.rb', line 16 def self.identifier_class_for_type(type) class_name = TYPE_CLASSES[type] return nil unless class_name Identifiers.const_get(class_name) end |
Instance Method Details
#to_s(with_publisher: true) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pubid/jis/single_identifier.rb', line 23 def to_s(with_publisher: true) parts = [] parts << publisher if with_publisher parts << type_prefix if self.class.method_defined?(:type_prefix) && type_prefix result = parts.join(" ") result += " " if result.length.positive? result += code.to_s result += ":#{year}" if year result += "(#{language})" if language result += "(規格群)" if all_parts? result end |