aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/core_ext/object/misc.rb5
-rw-r--r--activesupport/test/core_ext/object_and_class_ext_test.rb5
3 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 1546dfb8c0..1d94b13319 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Alias Object#send to send! for Ruby 1.9 forward compatibility. [Jeremy Kemper]
+
* Backport Object#instance_variable_defined? for Ruby < 1.8.6. [Jeremy Kemper]
* BufferedLogger#add doesn't modify the message argument. #9702 [eigentone]
diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb
index b93db689a7..e46cfe1b9b 100644
--- a/activesupport/lib/active_support/core_ext/object/misc.rb
+++ b/activesupport/lib/active_support/core_ext/object/misc.rb
@@ -1,4 +1,9 @@
class Object
+ unless respond_to?(:send!)
+ # Anticipating Ruby 1.9 neutering send
+ alias send! send
+ end
+
# A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
#
# def foo
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb
index 1987b70589..f885d94be3 100644
--- a/activesupport/test/core_ext/object_and_class_ext_test.rb
+++ b/activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -108,6 +108,11 @@ class ClassExtTest < Test::Unit::TestCase
end
class ObjectTests < Test::Unit::TestCase
+ def test_send_bang_aliases_send_before_19
+ assert_respond_to 'a', :send!
+ assert_equal 1, 'a'.send!(:size)
+ end
+
def test_suppress_re_raises
assert_raises(LoadError) { suppress(ArgumentError) {raise LoadError} }
end