Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ruby 1.9.2: work around Array allowing method_missing for to_ary

  • Loading branch information...
commit f07bcf015e35c400f12bf8274dc9cc4ec38be986 1 parent c0ebc21
@jeremy jeremy authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 activesupport/lib/active_support/core_ext/array/wrap.rb
View
7 activesupport/lib/active_support/core_ext/array/wrap.rb
@@ -4,11 +4,10 @@ class Array
def self.wrap(object)
if object.nil?
[]
- # to_a doesn't work correctly with Array() but to_ary always does
- elsif object.respond_to?(:to_a) && !object.respond_to?(:to_ary)
- [object]
+ elsif object.respond_to?(:to_ary)
+ object.to_ary
else
- Array(object)
+ [object]
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.