Use %r around regular expressions that contain slashes

This commit is contained in:
Erik Michaels-Ober 2015-05-25 11:24:12 +02:00
parent 7b46987960
commit dfede3a526
2 changed files with 2 additions and 2 deletions

View File

@ -161,7 +161,7 @@ module OmniAuth
return OmniAuth.config.camelizations[word.to_s] if OmniAuth.config.camelizations[word.to_s]
if first_letter_in_uppercase
word.to_s.gsub(/\/(.?)/) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
word.to_s.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
else
word.first + camelize(word)[1..-1]
end

View File

@ -394,7 +394,7 @@ module OmniAuth
options[:setup_path] || "#{path_prefix}/#{name}/setup"
end
CURRENT_PATH_REGEX = /\/$/
CURRENT_PATH_REGEX = %r{/$}
EMPTY_STRING = ''.freeze
def current_path
@current_path ||= request.path_info.downcase.sub(CURRENT_PATH_REGEX, EMPTY_STRING)