aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object_and_class.rb
diff options
context:
space:
mode:
authorSam Stephenson <sam@37signals.com>2006-01-23 06:40:43 +0000
committerSam Stephenson <sam@37signals.com>2006-01-23 06:40:43 +0000
commitd921b799747aacb47dc8bbca9b2eefe25159e9d5 (patch)
tree166ed212aeafff5269f1e77badb88c6b958e36ff /activesupport/lib/active_support/core_ext/object_and_class.rb
parent9c24899ab0fad8baa4db543dd45f3d20ae95d3b3 (diff)
downloadrails-d921b799747aacb47dc8bbca9b2eefe25159e9d5.tar.gz
rails-d921b799747aacb47dc8bbca9b2eefe25159e9d5.tar.bz2
rails-d921b799747aacb47dc8bbca9b2eefe25159e9d5.zip
Add Object#instance_exec and Proc#bind
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3469 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object_and_class.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/object_and_class.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object_and_class.rb b/activesupport/lib/active_support/core_ext/object_and_class.rb
index 4856a9f5d5..d44afbd839 100644
--- a/activesupport/lib/active_support/core_ext/object_and_class.rb
+++ b/activesupport/lib/active_support/core_ext/object_and_class.rb
@@ -65,6 +65,12 @@ class Object #:nodoc:
def to_json
ActiveSupport::JSON.encode(self)
end
+
+ unless defined? instance_exec # 1.9
+ def instance_exec(*arguments, &block)
+ block.bind(self)[*arguments]
+ end
+ end
end
class Class #:nodoc: