Module: Infuser::Helpers::Hashie

Included in:
Models::Base, Tables::Base
Defined in:
lib/infuser/helpers/hashie.rb

Instance Method Summary collapse

Instance Method Details

#camelize_hash(hash) ⇒ Object



5
6
7
8
9
# File 'lib/infuser/helpers/hashie.rb', line 5

def camelize_hash hash
  hash.each_with_object({}) do |(key, value), h|
    h[key.to_s.split('_').map { |w| safe_classify(w) }.join] = value
  end
end

#safe_classify(w) ⇒ Object



11
12
13
# File 'lib/infuser/helpers/hashie.rb', line 11

def safe_classify w
  w[0] = w[0].upcase; w
end