Class: RelatonItu::ItuBibliographicItem

Inherits:
RelatonBib::BibliographicItem
  • Object
show all
Defined in:
lib/relaton_itu/itu_bibliographic_item.rb

Constant Summary collapse

TYPES =
%w[
  recommendation recommendation-supplement recommendation-amendment
  recommendation-corrigendum recommendation-errata recommendation-annex
  focus-group implementers-guide technical-paper technical-report
  joint-itu-iso-iec resolution service-publication handbook question
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ ItuBibliographicItem

Returns a new instance of ItuBibliographicItem.


11
12
13
14
15
16
# File 'lib/relaton_itu/itu_bibliographic_item.rb', line 11

def initialize(**args)
  if args[:doctype] && !TYPES.include?(args[:doctype])
    warn "[relaton-itu] WARNING: invalid doctype: #{args[:doctype]}"
  end
  super
end

Class Method Details

.from_hash(hash) ⇒ RelatonItu::ItuBibliographicItem

Parameters:

  • hash (Hash)

Returns:


20
21
22
23
# File 'lib/relaton_itu/itu_bibliographic_item.rb', line 20

def self.from_hash(hash)
  item_hash = ::RelatonItu::HashConverter.hash_to_bib(hash)
  new **item_hash
end