module Talkgh::Keys
Constants
- ATTRIBUTE_KEYS
- PATTERN
Public Instance Methods
attribute_key(k)
click to toggle source
# File lib/talkgh/keys.rb, line 38 def attribute_key(k) return k if k.is_a?(Symbol) ATTRIBUTE_KEYS[k] end
camelcase(hash)
click to toggle source
# File lib/talkgh/keys.rb, line 9 def camelcase(hash) hash.transform_keys { |k| camelcase_key(k) } end
camelcase_key(k)
click to toggle source
# File lib/talkgh/keys.rb, line 26 def camelcase_key(k) k.to_s.gsub(/_(\w)/) { $1.upcase } end
hyphenate(hash)
click to toggle source
# File lib/talkgh/keys.rb, line 5 def hyphenate(hash) hash.transform_keys { |k| hyphenate_key(k) } end
hyphenate_key(k)
click to toggle source
# File lib/talkgh/keys.rb, line 22 def hyphenate_key(k) k.to_s.tr('_', '-') end