Created
May 14, 2010 18:06
-
-
Save psi/401439 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 551f672638e05221ad898fdbd3c1ea8ef56aa627 Mon Sep 17 00:00:00 2001 | |
From: JD Harrington <psi@y0ru.net> | |
Date: Fri, 14 May 2010 12:13:13 -0400 | |
Subject: [PATCH] Fix Regexp#to_s when using %r | |
--- | |
kernel/common/regexp.rb | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/kernel/common/regexp.rb b/kernel/common/regexp.rb | |
index d15f8b7..9d46c7d 100644 | |
--- a/kernel/common/regexp.rb | |
+++ b/kernel/common/regexp.rb | |
@@ -293,7 +293,7 @@ class Regexp | |
end | |
def to_s | |
- source | |
+ source.gsub(%r!(^|[^\\])/!) { "#{$1}\\/" } | |
end | |
def has_options! | |
-- | |
1.7.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment