Module: Relaton3gpp::HashConverter

Extended by:
HashConverter
Includes:
RelatonBib::HashConverter
Included in:
HashConverter
Defined in:
lib/relaton_3gpp/hash_converter.rb

Instance Method Summary collapse

Instance Method Details

#bib_item(item_hash) ⇒ Relaton3gpp::BibliographicItem

Parameters:

  • item_hash (Hash)

Returns:



23
24
25
# File 'lib/relaton_3gpp/hash_converter.rb', line 23

def bib_item(item_hash)
  BibliographicItem.new(**item_hash)
end

#create_doctype(**type) ⇒ Object



27
28
29
# File 'lib/relaton_3gpp/hash_converter.rb', line 27

def create_doctype(**type)
  DocumentType.new(**type)
end

#hash_to_bib(args) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/relaton_3gpp/hash_converter.rb', line 6

def hash_to_bib(args)
  hash = super
  hash[:radiotechnology] = hash[:ext][:radiotechnology] if hash.dig(:ext, :radiotechnology)
  hash[:common_ims_spec] = hash[:ext][:"common-ims-spec"] if hash.dig(:ext, :"common-ims-spec")
  release_hash_to_bib(hash)
  hash
end

#release_hash_to_bib(hash) ⇒ Object



14
15
16
17
18
19
# File 'lib/relaton_3gpp/hash_converter.rb', line 14

def release_hash_to_bib(hash)
  release = hash.dig(:ext, :release) || hash[:release] # @TODO remove hash[:release] after release is moved to ext
  return unless release

  hash[:release] = Release.new(**release)
end