diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array/wrap.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/wrap.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 0eb93a0ded..e211bdeeca 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -11,17 +11,12 @@ class Array # Array("foo\nbar") # => ["foo\n", "bar"], in Ruby 1.8 # Array.wrap("foo\nbar") # => ["foo\nbar"] def self.wrap(object) - case object - when nil + if object.nil? [] - when self - object + elsif object.respond_to?(:to_ary) + object.to_ary else - if object.respond_to?(:to_ary) - object.to_ary - else - [object] - end + [object] end end end |