Module: J7W1::Util

Extended by:
Util
Included in:
J7W1, Configuration, Util
Defined in:
lib/j7w1/util.rb

Instance Method Summary collapse

Instance Method Details

#normalize_platform(platform) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/j7w1/util.rb', line 3

def normalize_platform(platform)
  platform = platform.to_s.downcase.to_sym unless platform.is_a? Symbol

  case platform
    when :ios, :'iphone os', :'ipad os'
      :ios
    when :android
      :android
    else
      platform
  end
end

#symbolize_keys_recursive(hash) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/j7w1/util.rb', line 16

def symbolize_keys_recursive(hash)
  hash.inject({}) do |h, kv|
    (key, value) = kv
    h[key.to_sym] =
        value.is_a?(Hash) ? symbolize_keys_recursive(value) : value
    h
  end
end