Module: TransformHashKeys
- Included in:
- RockRMS::Client
- Defined in:
- lib/rock_rms/transform_hash_keys.rb
Class Method Summary collapse
Class Method Details
.camelize(term) ⇒ Object
8 9 10 |
# File 'lib/rock_rms/transform_hash_keys.rb', line 8 def self.camelize(term) term.to_s.gsub(/(?:^|_+)([^_])/) { $1.upcase }.tap { |s| s[0] = s[0].downcase } end |
.camelize_keys(hash) ⇒ Object
2 3 4 5 6 |
# File 'lib/rock_rms/transform_hash_keys.rb', line 2 def self.camelize_keys(hash) hash .filter { |_, v| v } .transform_keys { |k| camelize(k) } end |