Sha256: 070e444e1052b83e9a47ccda2ce303ec3bbac1bbec329385d6a995c3c281bcde

Contents?: true

Size: 280 Bytes

Versions: 10

Compression:

Stored size: 280 Bytes

Contents

#
# Extend the core Array class to include `.wrap`
#
class Array
  # Duplication of Ruby on Rails Array#wrap method
  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

10 entries across 10 versions & 1 rubygems

Version Path
dnc-0.1.9 lib/array.rb
dnc-1.0.0 lib/array.rb
dnc-0.1.8 lib/array.rb
dnc-0.1.6 lib/array.rb
dnc-0.1.5 lib/array.rb
dnc-0.1.4 lib/array.rb
dnc-0.1.3 lib/array.rb
dnc-0.1.2 lib/array.rb
dnc-0.1.1 lib/array.rb
dnc-0.1 lib/array.rb