Class: Pubid::Itu::Identifier::Supplement

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/itu/identifier/supplement.rb

Direct Known Subclasses

Addendum, Amendment, Annex, Appendix, Corrigendum

Instance Attribute Summary collapse

Attributes inherited from Base

#amendment, #annex, #date, #range, #second_number, #sector, #series, #subseries

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

get_parser_class, get_renderer_class, get_transformer_class, has_type?, #to_s, transform, transform_supplements

Constructor Details

#initialize(base: nil, **opts) ⇒ Supplement

Returns a new instance of Supplement.



8
9
10
11
# File 'lib/pubid/itu/identifier/supplement.rb', line 8

def initialize(base: nil, **opts)
  super(**opts)
  @base = base
end

Instance Attribute Details

#baseObject

Returns the value of attribute base.



6
7
8
# File 'lib/pubid/itu/identifier/supplement.rb', line 6

def base
  @base
end

Class Method Details

.typeObject



19
20
21
# File 'lib/pubid/itu/identifier/supplement.rb', line 19

def self.type
  { key: :supplement, title: "Supplement" }
end

Instance Method Details

#to_h(deep: false) ⇒ Object



13
14
15
16
17
# File 'lib/pubid/itu/identifier/supplement.rb', line 13

def to_h(deep: false)
  # XXX: hack to render supplements using Base renderer, because we need to
  # place date published after amendment, e.g. `ITU-T G.780/Y.1351 Amd 1 (2004)`
  @base.to_h(deep: deep).merge(self.type[:key] => super)
end