Skip to content
Browse files

Monkeypatch Regexp::escape to support Pathnames, which is called inco…

…rrectly by Rubygems 1.8.10 and Rails 3.0.10.
  • Loading branch information...
1 parent c6691d0 commit 5a69888beea01505ae4916c3d76828c8130ea381 @igal igal committed Oct 16, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 config/boot.rb
View
11 config/boot.rb
@@ -1,5 +1,16 @@
require 'rubygems'
+# Monkeypatch to make Regexp::escape support Pathnames. This is a bug present in Rubygems 1.8.10 and Rails 3.0.10.
+require 'pathname'
+class Regexp
+ class << self
+ alias_method :escape_without_pathname, :escape
+ def escape(*args)
+ self.escape_without_pathname(* args.first.kind_of?(Pathname) ? [args.first.to_s, *args[1..-1]] : args)
+ end
+ end
+end
+
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

0 comments on commit 5a69888

Please sign in to comment.
Something went wrong with that request. Please try again.