Module: OmniAuth::Utils

Defined in:
lib/omniauth.rb

Class Method Summary collapse

Class Method Details

.camelize(word, first_letter_in_uppercase = true) ⇒ Object



129
130
131
132
133
134
135
136
137
# File 'lib/omniauth.rb', line 129

def camelize(word, first_letter_in_uppercase = true)
  return OmniAuth.config.camelizations[word.to_s] if OmniAuth.config.camelizations[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



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/omniauth.rb', line 114

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

.form_cssObject



110
111
112
# File 'lib/omniauth.rb', line 110

def form_css
  "<style type='text/css'>#{OmniAuth.config.form_css}</style>"
end