Module: OmniAuth::Utils
- Defined in:
- lib/omniauth/core.rb
Constant Summary collapse
- CAMELIZE_SPECIAL =
{ 'oauth' => 'OAuth', 'oauth2' => 'OAuth2', 'openid' => 'OpenID', 'open_id' => 'OpenID', 'github' => 'GitHub', 'tripit' => 'TripIt', 'soundcloud' => 'SoundCloud' }
Class Method Summary collapse
- .camelize(word, first_letter_in_uppercase = true) ⇒ Object
- .deep_merge(hash, other_hash) ⇒ Object
- .form_css ⇒ Object
Class Method Details
.camelize(word, first_letter_in_uppercase = true) ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/omniauth/core.rb', line 87 def camelize(word, first_letter_in_uppercase = true) return CAMELIZE_SPECIAL[word.to_s] if CAMELIZE_SPECIAL[word.to_s] if first_letter_in_uppercase word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } else word.first + camelize(word)[1..-1] end end |
.deep_merge(hash, other_hash) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/omniauth/core.rb', line 72 def deep_merge(hash, other_hash) target = hash.dup other_hash.keys.each do |key| if other_hash[key].is_a? ::Hash and hash[key].is_a? ::Hash target[key] = deep_merge(target[key],other_hash[key]) next end target[key] = other_hash[key] end target end |