Sha256: e2b9442e1baebd9742c36e4b3fb4a720435f114b319dbf79714ced987907b6ad
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
module RelatonIho class HashConverter < RelatonBib::HashConverter class << self # @override RelatonIsoBib::HashConverter.hash_to_bib # @param args [Hash] # @param nested [TrueClass, FalseClass] # @return [Hash] def hash_to_bib(args, nested = false) ret = super return if ret.nil? commentperiod_hash_to_bib ret ret end private # @param ret [Hash] def commentperiod_hash_to_bib(ret) ret[:commentperiod] &&= CommentPeriond.new(ret[:commentperiod]) end # @param ret [Hash] def editorialgroup_hash_to_bib(ret) eg = ret[:editorialgroup] return unless eg.is_a?(Hash) || eg&.any? collection = array(eg).map do |g| EditorialGroup.new(array(g).map { |wg| iho_workgroup wg }) end ret[:editorialgroup] = EditorialGroupCollection.new collection end # @param ihowg [Hash] # @return [RelatonIho::Committee, RelatonIho::Workgroup, # RelatonIho::Commission] def iho_workgroup(ihowg) key, value = ihowg&.first return unless key && value.is_a?(Hash) klass = Object.const_get "RelatonIho::#{key.capitalize}" subwg = value.select do |k, _| %i[committee workgroup commission].include? k end klass.new value[:abbreviation], value[:name], iho_workgroup(subwg) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
relaton-iho-1.4.0 | lib/relaton_iho/hash_converter.rb |
relaton-iho-1.3.2 | lib/relaton_iho/hash_converter.rb |
relaton-iho-1.3.1 | lib/relaton_iho/hash_converter.rb |