Module: Nexmo::Keys

Included in:
Conversions, Numbers, SMS
Defined in:
lib/nexmo/keys.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#camelcase(hash) ⇒ Object



10
11
12
# File 'lib/nexmo/keys.rb', line 10

def camelcase(hash)
  hash.transform_keys { |k| camelcase_key(k) }
end

#camelcase_key(k) ⇒ Object



27
28
29
# File 'lib/nexmo/keys.rb', line 27

def camelcase_key(k)
  k.to_s.gsub(/_(\w)/) { $1.upcase }
end

#hyphenate(hash) ⇒ Object



6
7
8
# File 'lib/nexmo/keys.rb', line 6

def hyphenate(hash)
  hash.transform_keys { |k| hyphenate_key(k) }
end

#hyphenate_key(k) ⇒ Object



23
24
25
# File 'lib/nexmo/keys.rb', line 23

def hyphenate_key(k)
  k.to_s.tr('_', '-')
end