Method: IsoDoc::PresentationXMLConvert#trim_hash1

Defined in:
lib/isodoc/presentation_function/bibdata.rb

#trim_hash1(h) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/isodoc/presentation_function/bibdata.rb', line 83

def trim_hash1(h)
  return h unless h.is_a? Hash
  h.each_with_object({}) do |(k,v), g|
    next if blank?(v)
    g[k] = if v.is_a? Hash then trim_hash1(h[k])
           elsif v.is_a? Array
             h[k].map { |a| trim_hash1(a) }.reject { |a| blank?(a) }
           else
             v
           end
  end
end