Use %r around regular expressions that contain slashes
This commit is contained in:
parent
7b46987960
commit
dfede3a526
|
@ -161,7 +161,7 @@ module OmniAuth
|
||||||
return OmniAuth.config.camelizations[word.to_s] if OmniAuth.config.camelizations[word.to_s]
|
return OmniAuth.config.camelizations[word.to_s] if OmniAuth.config.camelizations[word.to_s]
|
||||||
|
|
||||||
if first_letter_in_uppercase
|
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
|
else
|
||||||
word.first + camelize(word)[1..-1]
|
word.first + camelize(word)[1..-1]
|
||||||
end
|
end
|
||||||
|
|
|
@ -394,7 +394,7 @@ module OmniAuth
|
||||||
options[:setup_path] || "#{path_prefix}/#{name}/setup"
|
options[:setup_path] || "#{path_prefix}/#{name}/setup"
|
||||||
end
|
end
|
||||||
|
|
||||||
CURRENT_PATH_REGEX = /\/$/
|
CURRENT_PATH_REGEX = %r{/$}
|
||||||
EMPTY_STRING = ''.freeze
|
EMPTY_STRING = ''.freeze
|
||||||
def current_path
|
def current_path
|
||||||
@current_path ||= request.path_info.downcase.sub(CURRENT_PATH_REGEX, EMPTY_STRING)
|
@current_path ||= request.path_info.downcase.sub(CURRENT_PATH_REGEX, EMPTY_STRING)
|
||||||
|
|
Loading…
Reference in New Issue