Class: OpenStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_client/utils.rb

Instance Method Summary collapse

Instance Method Details

#deep_to_hObject



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/flow_client/utils.rb', line 55

def deep_to_h
  each_pair.map do |key, value|
    [
      key,
      case value
        when OpenStruct then value.deep_to_h
        when Array then value.map {|el| el.class == OpenStruct ? el.deep_to_h : el}
        else value
      end
    ]
  end.to_h
end