aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/wrap.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-06-30 00:08:43 +0100
committerJon Leighton <j@jonathanleighton.com>2011-06-30 00:21:42 +0100
commitb4d8c7d148c6b44eea6701687ca2a97df9088747 (patch)
treeb9163b21a238ee22e14d5e651b8c74caee622af4 /activesupport/lib/active_support/core_ext/array/wrap.rb
parente9fa602e1c70a5c8e1644b218d5784e7c195eb35 (diff)
downloadrails-b4d8c7d148c6b44eea6701687ca2a97df9088747.tar.gz
rails-b4d8c7d148c6b44eea6701687ca2a97df9088747.tar.bz2
rails-b4d8c7d148c6b44eea6701687ca2a97df9088747.zip
Array.wrap should follow Kernel#Array semantics when the object's to_ary is nil. In this case, the object should be wrapped.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array/wrap.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/array/wrap.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb
index f420270dc4..4834eca8b1 100644
--- a/activesupport/lib/active_support/core_ext/array/wrap.rb
+++ b/activesupport/lib/active_support/core_ext/array/wrap.rb
@@ -40,7 +40,7 @@ class Array
if object.nil?
[]
elsif object.respond_to?(:to_ary)
- object.to_ary
+ object.to_ary || [object]
else
[object]
end