aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2019-07-11 17:39:19 +0200
committerJean Boussier <jean.boussier@gmail.com>2019-07-12 10:47:23 +0200
commit71476313e0f94b7887bcb7aad3956c0d62505f4c (patch)
treee7415c92023dc51965ec59433c83bc2d4a232a49 /activesupport/lib
parent59f450500c37466fe7834cb1d3fa3a6cc8e643b5 (diff)
downloadrails-71476313e0f94b7887bcb7aad3956c0d62505f4c.tar.gz
rails-71476313e0f94b7887bcb7aad3956c0d62505f4c.tar.bz2
rails-71476313e0f94b7887bcb7aad3956c0d62505f4c.zip
Implement UnboundMethod#duplicable?
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/object/duplicable.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
index 265bb7bf48..3ebcdca02b 100644
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
@@ -1,4 +1,3 @@
-
# frozen_string_literal: true
#--
@@ -38,3 +37,13 @@ class Method
false
end
end
+
+class UnboundMethod
+ # Unbound methods are not duplicable:
+ #
+ # method(:puts).unbind.duplicable? # => false
+ # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
+ def duplicable?
+ false
+ end
+end