diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-12 16:31:23 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-13 09:52:53 -0800 |
commit | f07bcf015e35c400f12bf8274dc9cc4ec38be986 (patch) | |
tree | 079581b23ccddd0536d30f6f6263231a50cb79a0 /activesupport | |
parent | c0ebc2149380a59371553765053f55671c737533 (diff) | |
download | rails-f07bcf015e35c400f12bf8274dc9cc4ec38be986.tar.gz rails-f07bcf015e35c400f12bf8274dc9cc4ec38be986.tar.bz2 rails-f07bcf015e35c400f12bf8274dc9cc4ec38be986.zip |
Ruby 1.9.2: work around Array allowing method_missing for to_ary
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/wrap.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 38bb68c1ec..f48d5ce500 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/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 |