Module: Voom::Presenters::WebClient::Helpers::ExpandHash
- Included in:
- Demo::DragonDrop
- Defined in:
- lib/voom/presenters/web_client/helpers/expand_hash.rb
Instance Method Summary collapse
Instance Method Details
#expand_hash(h) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/voom/presenters/web_client/helpers/expand_hash.rb', line 6 def (h) HashExt::Traverse.traverse(h.to_h) do |k,v| if !v.is_a?(Array) && v.respond_to?(:to_h) v = v.is_a?(OpenStruct) ? (v.to_h) : v.to_h elsif v.is_a?(Array) v = v.map {|v| v.is_a?(OpenStruct) ? (v.to_h) : v} elsif v.respond_to?(:to_hash) v = v.to_hash end [k,v] end end |