Sha256: 13e8993e40243dc6eb55419087b4e53cc95d151718b6761928a2d287968fd535

Contents?: true

Size: 321 Bytes

Versions: 9

Compression:

Stored size: 321 Bytes

Contents

##
# Copied directly from ActiveSupport
# <https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/array/wrap.rb>
#
class Array
  def self.wrap(object)
    if object.nil?
      []
    elsif object.respond_to?(:to_ary)
      object.to_ary || [object]
    else
      [object]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
npr-3.0.0 lib/npr/core_ext/array/wrap.rb
npr-2.0.2 lib/npr/core_ext/array/wrap.rb
npr-2.0.1 lib/npr/core_ext/array/wrap.rb
npr-2.0.0 lib/npr/core_ext/array/wrap.rb
npr-1.2.0 lib/npr/core_ext/array/wrap.rb
npr-1.1.0 lib/npr/core_ext/array/wrap.rb
npr-0.1.2 lib/npr/core_ext/array/wrap.rb
npr-0.1.1 lib/npr/core_ext/array/wrap.rb
npr-0.1.0 lib/npr/core_ext/array/wrap.rb