Module: RelatonIec::HashConverter

Extended by:
HashConverter
Includes:
RelatonIsoBib::HashConverter
Included in:
HashConverter
Defined in:
lib/relaton_iec/hash_converter.rb

Instance Method Summary collapse

Instance Method Details

#bib_item(item) ⇒ Object

Ovverides superclass’s method

Parameters:

  • item (Hash)


25
26
27
# File 'lib/relaton_iec/hash_converter.rb', line 25

def bib_item(item)
  IecBibliographicItem.new(**item)
end

#create_doctype(**args) ⇒ Object



29
30
31
# File 'lib/relaton_iec/hash_converter.rb', line 29

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

#hash_to_bib(hash) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/relaton_iec/hash_converter.rb', line 6

def hash_to_bib(hash)
  ret = super
  ret[:function] = ret[:ext][:function] if ret.dig(:ext, :function)
  ret[:updates_document_type] = ret[:ext][:updates_document_type] if ret.dig(:ext, :updates_document_type)
  unless ret.dig(:ext, :accessibility_color_inside).nil?
    ret[:accessibility_color_inside] = ret[:ext][:accessibility_color_inside]
  end
  ret[:price_code] = ret[:ext][:price_code] if ret.dig(:ext, :price_code)
  ret[:cen_processing] = ret[:ext][:cen_processing] unless ret.dig(:ext, :cen_processing).nil?
  ret[:secretary] = ret[:ext][:secretary] if ret.dig(:ext, :secretary)
  ret[:interest_to_committees] = ret[:ext][:interest_to_committees] if ret.dig(:ext, :interest_to_committees)
  ret
end