Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goyox86/488997 to your computer and use it in GitHub Desktop.
Save goyox86/488997 to your computer and use it in GitHub Desktop.
From 308c6a2d41ab0a4dfa4fb9dc7ff07fa9df01e8a0 Mon Sep 17 00:00:00 2001
From: Jose Narvaez <[email protected]>
Date: Sat, 24 Jul 2010 17:16:27 -0430
Subject: [PATCH] Fix MatchData#string returns a frozen copy of the match string
---
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 c734d7c..1b0737f 100644
--- a/kernel/common/regexp.rb
+++ b/kernel/common/regexp.rb
@@ -568,7 +568,7 @@ end
class MatchData
def string
- @source
+ @source.dup.freeze
end
def source
--
1.7.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment