Class: OpenStruct

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

Instance Method Summary collapse

Instance Method Details

#deep_to_hObject



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/flow_client/utils.rb', line 66

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