Module: RelatonIeee::HashConverter

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

Instance Method Summary collapse

Instance Method Details

#bib_item(item_hash) ⇒ RelatonIeee::IeeeBibliographicItem

Parameters:

  • item_hash (Hash)

Returns:



19
20
21
# File 'lib/relaton_ieee/hash_converter.rb', line 19

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

#create_doctype(**args) ⇒ Object



40
41
42
# File 'lib/relaton_ieee/hash_converter.rb', line 40

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

#editorialgroup_hash_to_bib(hash) ⇒ Object

Parameters:

  • hash (Hash)


24
25
26
27
28
# File 'lib/relaton_ieee/hash_converter.rb', line 24

def editorialgroup_hash_to_bib(hash)
  return unless hash[:editorialgroup]

  hash[:editorialgroup] = EditorialGroup.new(**hash[:editorialgroup])
end

#ext_hash_to_bib(hash) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/relaton_ieee/hash_converter.rb', line 30

def ext_hash_to_bib(hash)
  ext = hash.delete(:ext)
  return unless ext

  attrs = %i[standard_status standard_modified pubstatus holdstatus]
  ext.select { |k, _| attrs.include? k }.each do |k, v|
    hash[k] = v
  end
end

#hash_to_bib(args) ⇒ Hash

Parameters:

  • args (Hash)
  • neated (TrueClas, FalseClass)

    default true

Returns:

  • (Hash)


8
9
10
11
12
13
14
15
# File 'lib/relaton_ieee/hash_converter.rb', line 8

def hash_to_bib(args)
  hash = super
  return unless hash.is_a?(Hash)

  # editorialgroup_hash_to_bib hash
  ext_hash_to_bib hash
  hash
end