From dfede3a5260307b8ad0d8ef6b59c580715070713 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 25 May 2015 11:24:12 +0200 Subject: [PATCH] Use %r around regular expressions that contain slashes --- lib/omniauth.rb | 2 +- lib/omniauth/strategy.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/omniauth.rb b/lib/omniauth.rb index a94d975..9b53cd2 100644 --- a/lib/omniauth.rb +++ b/lib/omniauth.rb @@ -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 diff --git a/lib/omniauth/strategy.rb b/lib/omniauth/strategy.rb index dcea8d9..b1839d2 100644 --- a/lib/omniauth/strategy.rb +++ b/lib/omniauth/strategy.rb @@ -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)