You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1019 B
38 lines
1019 B
10 years ago
|
From 74784e8f7889c3b8f0bb337f04b050e79a3df34a Mon Sep 17 00:00:00 2001
|
||
|
From: Ryunosuke SATO <tricknotes.rs@gmail.com>
|
||
|
Date: Tue, 14 Oct 2014 23:02:28 +0900
|
||
|
Subject: [PATCH] Handle error about frozen object in Ruby 2.2
|
||
|
|
||
|
This kind of error message seems to be updated in Ruby 2.2.
|
||
|
|
||
|
For example, the following code throws an error that has different
|
||
|
error message with Ruby version:
|
||
|
```
|
||
|
"".freeze.instance_eval do
|
||
|
def hi
|
||
|
end
|
||
|
end
|
||
|
```
|
||
|
|
||
|
In Ruby 2.1.3:
|
||
|
> RuntimeError: can't modify frozen Class
|
||
|
|
||
|
In Ruby 2.2.0-preview1:
|
||
|
> RuntimeError: can't modify frozen object
|
||
|
---
|
||
|
lib/pry/exceptions.rb | 1 +
|
||
|
1 file changed, 1 insertion(+)
|
||
|
|
||
|
diff --git a/lib/pry/exceptions.rb b/lib/pry/exceptions.rb
|
||
|
index 0204d84..080b72e 100644
|
||
|
--- a/lib/pry/exceptions.rb
|
||
|
+++ b/lib/pry/exceptions.rb
|
||
|
@@ -52,6 +52,7 @@ module FrozenObjectException
|
||
|
def self.===(exception)
|
||
|
["can't modify frozen class/module",
|
||
|
"can't modify frozen Class",
|
||
|
+ "can't modify frozen object",
|
||
|
].include?(exception.message)
|
||
|
end
|
||
|
end
|