diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-22 15:31:45 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-22 15:31:45 -0700 |
commit | fad83d8cbbbd0862a758a1c09c7dcc6f74a25d60 (patch) | |
tree | 510a99740da381a64db66fe1601b7ebf263c837a /activesupport/lib | |
parent | 64249223ebb2b51814d8764c498b14a12d072b83 (diff) | |
parent | 9c857db75788c21f6184279c130e79f21c750f9f (diff) | |
download | rails-fad83d8cbbbd0862a758a1c09c7dcc6f74a25d60.tar.gz rails-fad83d8cbbbd0862a758a1c09c7dcc6f74a25d60.tar.bz2 rails-fad83d8cbbbd0862a758a1c09c7dcc6f74a25d60.zip |
Merge pull request #5552 from lest/patch-3
deprecate Proc#bind that can cause symbol memory leak
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/proc.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/rescuable.rb | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/proc.rb b/activesupport/lib/active_support/core_ext/proc.rb index 94bb5fb0cb..cd63740940 100644 --- a/activesupport/lib/active_support/core_ext/proc.rb +++ b/activesupport/lib/active_support/core_ext/proc.rb @@ -1,7 +1,10 @@ require "active_support/core_ext/kernel/singleton_class" +require "active_support/deprecation" class Proc #:nodoc: def bind(object) + ActiveSupport::Deprecation.warn 'Proc#bind is deprecated and will be removed in future versions', caller + block, time = self, Time.now object.class_eval do method_name = "__bind_#{time.to_i}_#{time.usec}" diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index 0f4a06468a..7ed426a90d 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -108,7 +108,7 @@ module ActiveSupport when Symbol method(rescuer) when Proc - rescuer.bind(self) + Proc.new { |*args| instance_exec(*args, &rescuer) } end end end |