Module: EVEApi::Util

Defined in:
lib/eveapi/util.rb

Overview

Utility methods

Instance Method Summary collapse

Instance Method Details

#convert_hash_keys(value) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/eveapi/util.rb', line 55

def convert_hash_keys(value)
  case value
  when Array
    value.map { |v| convert_hash_keys(v) }
  when Hash
    Hash[value.map { |k, v| [underscore_key(k), convert_hash_keys(v)] }]
  else
    value
  end
end

#underscore_key(k) ⇒ Object



51
52
53
# File 'lib/eveapi/util.rb', line 51

def underscore_key(k)
  k.to_s.underscore.to_sym
end