Class: Pubid::Itu::Identifiers::CombinedIdentifier

Inherits:
Base show all
Defined in:
lib/pubid/itu/identifiers/combined_identifier.rb

Overview

Combined identifier for dual-series recommendations Format: ITU-T G.780/Y.1351 Example: ITU-T G.780/Y.1351 (2004)

Constant Summary

Constants inherited from Base

Base::LANGUAGES

Instance Method Summary collapse

Methods inherited from Base

#==, #base_hash, #initialize, normalize_to_s_opts, #publisher, #render_base, #render_language_suffix

Methods inherited from Pubid::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::Itu::Identifiers::Base

Instance Method Details

#to_sObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/pubid/itu/identifiers/combined_identifier.rb', line 15

def to_s
  result = "#{publisher}-#{sector}"

  # Add primary series and code
  result += if series
              " #{series}.#{code}"
            else
              " #{code}"
            end

  # Add combined series and code
  if combined_series && combined_code
    result += "/#{combined_series}.#{combined_code}"
  end

  # Add date if present
  if date
    result += if date.month
                " (#{date.month}/#{date.year})"
              else
                " (#{date.year})"
              end
  end

  # Add language
  result += "-#{language}" if language

  result
end