Module: Warden::OAuth::Utils
- Defined in:
- lib/warden_oauth/utils.rb
Overview
Contains methods from Rails to avoid unnecessary dependencies
Class Method Summary collapse
-
.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
Fetched from ActiveSupport::Inflector.camelize to avoid dependencies.
-
.host_with_port(request) ⇒ Object
Fetched from ActionController::Request to avoid dependencies.
Class Method Details
.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
Fetched from ActiveSupport::Inflector.camelize to avoid dependencies
12 13 14 15 16 17 18 |
# File 'lib/warden_oauth/utils.rb', line 12 def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) if first_letter_in_uppercase lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1] end end |
.host_with_port(request) ⇒ Object
Fetched from ActionController::Request to avoid dependencies
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/warden_oauth/utils.rb', line 23 def host_with_port(request) url = request.scheme + "://" url << request.host if request.scheme == "https" && request.port != 443 || request.scheme == "http" && request.port != 80 url << ":#{request.port}" end url end |