Module: OmniAuth::Utils
- Defined in:
- lib/omniauth.rb
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
181 182 183 184 185 186 187 188 189 |
# File 'lib/omniauth.rb', line 181 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 camelize(word).tap { |w| w[0] = w[0].downcase } end end |
.deep_merge(hash, other_hash) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/omniauth.rb', line 166 def deep_merge(hash, other_hash) target = hash.dup other_hash.each_key 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 ⇒ Object
162 163 164 |
# File 'lib/omniauth.rb', line 162 def form_css "<style type='text/css'>#{OmniAuth.config.form_css}</style>" end |