module OmniAuth::Utils

Public Instance Methods

camelize(word, first_letter_in_uppercase = true) click to toggle source
# File lib/omniauth.rb, line 156
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(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
  else
    word.first + camelize(word)[1..-1]
  end
end
deep_merge(hash, other_hash) click to toggle source
# File lib/omniauth.rb, line 141
def deep_merge(hash, other_hash)
  target = hash.dup

  other_hash.keys.each do |key|
    if other_hash[key].is_a?(::Hash) && 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_css() click to toggle source
# File lib/omniauth.rb, line 137
def form_css
  "<style type='text/css'>#{OmniAuth.config.form_css}</style>"
end