Class: Pubid::Bsi::Identifiers::ExpertCommentary

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/bsi/identifiers/expert_commentary.rb

Overview

Expert Commentary Identifier Wraps a base identifier with Expert Commentary suffix Three formats:

  1. “Expert Commentary” (full form)

  2. “ExComm” (abbreviated form)

  3. “ExComm (Fire)” (with optional topic suffix)

Instance Method Summary collapse

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

Instance Method Details

#numberObject



37
38
39
# File 'lib/pubid/bsi/identifiers/expert_commentary.rb', line 37

def number
  base_identifier&.number
end

#publisherObject



33
34
35
# File 'lib/pubid/bsi/identifiers/expert_commentary.rb', line 33

def publisher
  base_identifier&.publisher
end

#to_sObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pubid/bsi/identifiers/expert_commentary.rb', line 17

def to_s
  base_str = base_identifier.to_s
  # Ensure suffix appears only once at the end
  base_str = base_str.sub(/ (Expert Commentary|ExComm(\s*\(.*\))?)$/,
                          "")

  case format
  when "full"
    "#{base_str} Expert Commentary"
  when "abbr_with_topic"
    "#{base_str} ExComm (#{topic})"
  else # "abbr" (default)
    "#{base_str} ExComm"
  end
end

#yearObject



41
42
43
# File 'lib/pubid/bsi/identifiers/expert_commentary.rb', line 41

def year
  base_identifier&.year
end