Sha256: 7b2ddb02327294a7761730730f9a4e6dece03a2582578d74c76d6a7157ee9871

Contents?: true

Size: 425 Bytes

Versions: 1

Compression:

Stored size: 425 Bytes

Contents

unless Array.respond_to?(:wrap)
  class Array
    # Wraps the object in an Array unless it's an Array.  Converts the
    # object to an Array using #to_ary if it implements that.
    def self.wrap(object)
      case object
      when nil
        []
      when self
        object
      else
        if object.respond_to?(:to_ary)
          object.to_ary
        else
          [object]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cassandra_object-0.6.0.pre vendor/activesupport/lib/active_support/core_ext/array/wrap.rb