Class: Pubid::Amca::Identifiers::Interpretation
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Base
- Pubid::Amca::Identifiers::Interpretation
- Defined in:
- lib/pubid/amca/identifiers/interpretation.rb
Overview
Interpretation identifier for ACMA interpretations Examples:
-
AMCA 99 JW Interp
-
AMCA 204 – 1
-
ANSI/AMCA 204 Interp
Instance Attribute Summary collapse
-
#interpretation_code ⇒ Object
readonly
Returns the value of attribute interpretation_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code:, year: nil, copublisher: nil, suffix: nil, reaffirmed: nil, interpretation_code: nil) ⇒ Interpretation
constructor
A new instance of Interpretation.
-
#to_s ⇒ String
The rendered interpretation identifier.
- #type ⇒ Object
Methods inherited from Base
#base_hash, parse, #publisher, #to_urn
Methods inherited from Identifier
#base_identifier, #eql?, #exclude, #hash, #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
#initialize(code:, year: nil, copublisher: nil, suffix: nil, reaffirmed: nil, interpretation_code: nil) ⇒ Interpretation
Returns a new instance of Interpretation.
14 15 16 17 18 19 20 21 22 |
# File 'lib/pubid/amca/identifiers/interpretation.rb', line 14 def initialize(code:, year: nil, copublisher: nil, suffix: nil, reaffirmed: nil, interpretation_code: nil) @code = Components::Code.new(value: code.to_s) @year = Components::Date.new(year: year.to_s) if year @copublisher = copublisher @suffix = suffix @reaffirmed = reaffirmed @interpretation_code = interpretation_code end |
Instance Attribute Details
#interpretation_code ⇒ Object (readonly)
Returns the value of attribute interpretation_code.
12 13 14 |
# File 'lib/pubid/amca/identifiers/interpretation.rb', line 12 def interpretation_code @interpretation_code end |
Class Method Details
.type ⇒ Object
24 25 26 |
# File 'lib/pubid/amca/identifiers/interpretation.rb', line 24 def self.type { key: :interpretation, title: "Interpretation", short: "Interp" } end |
Instance Method Details
#to_s ⇒ String
Returns the rendered interpretation identifier.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pubid/amca/identifiers/interpretation.rb', line 33 def to_s parts = [] parts << @copublisher if @copublisher parts << @code.to_s if @interpretation_code parts << "– #{@interpretation_code}" elsif @year parts << "-#{@year}" end parts << " #{@suffix}" if @suffix parts.join(" ").squeeze(" ") end |
#type ⇒ Object
28 29 30 |
# File 'lib/pubid/amca/identifiers/interpretation.rb', line 28 def type Interpretation.type end |