Module: RelatonIeee::HashConverter
- Extended by:
- HashConverter
- Includes:
- RelatonBib::HashConverter
- Included in:
- HashConverter
- Defined in:
- lib/relaton_ieee/hash_converter.rb
Instance Method Summary collapse
- #bib_item(item_hash) ⇒ RelatonIeee::IeeeBibliographicItem
- #create_doctype(**args) ⇒ Object
- #editorialgroup_hash_to_bib(hash) ⇒ Object
- #ext_hash_to_bib(hash) ⇒ Object
- #hash_to_bib(args) ⇒ Hash
Instance Method Details
#bib_item(item_hash) ⇒ RelatonIeee::IeeeBibliographicItem
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
41 42 43 |
# File 'lib/relaton_ieee/hash_converter.rb', line 41 def create_doctype(**args) DocumentType.new(**args) end |
#editorialgroup_hash_to_bib(hash) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/relaton_ieee/hash_converter.rb', line 24 def editorialgroup_hash_to_bib(hash) eg = hash.dig(:ext, :editorialgroup) || hash[:editorialgroup] return unless eg hash[:editorialgroup] = EditorialGroup.new(**eg) end |
#ext_hash_to_bib(hash) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/relaton_ieee/hash_converter.rb', line 31 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
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 |