Class: PlatformRest::Utils
- Inherits:
-
Object
- Object
- PlatformRest::Utils
- Defined in:
- lib/platform_rest/utils.rb
Class Method Summary collapse
Class Method Details
.fix_query_arrays(value) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/platform_rest/utils.rb', line 29 def self.fix_query_arrays(value) if value.respond_to?(:to_ary) value = value.to_ary.map.with_index.to_a.to_h.invert end if value.respond_to?(:to_hash) value = value.to_hash value.each do |k, v| value[k] = fix_query_arrays(v) end end value end |
.symbolize_hash_keys(hash) ⇒ Object
25 26 27 |
# File 'lib/platform_rest/utils.rb', line 25 def self.symbolize_hash_keys(hash) Hash[hash.dup.map { |k, v| [k.to_sym, v] }] end |