Class: Pubid::Itu::Identifiers::Corrigendum

Inherits:
Supplement
  • Object
show all
Defined in:
lib/pubid/itu/identifiers/corrigendum.rb

Overview

Corrigendum identifier (Cor.) Pattern: "ITU-T Z.100 (1999) Cor. 1 (10/2001)" Can be corrigendum of annex: "ITU-T G.729 Annex E (1998) Cor. 1 (02/2000)"

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/pubid/itu/identifiers/corrigendum.rb', line 32

def ==(other)
  return false unless other.is_a?(Corrigendum)

  base == other.base &&
    number == other.number &&
    date == other.date
end

#to_sObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pubid/itu/identifiers/corrigendum.rb', line 10

def to_s
  result = base ? base.to_s : "#{publisher}-#{sector}"

  # Add series if no base
  if !base && series
    result += " #{series}"
  end

  result += " Cor. #{number}"

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

  result
end