Sha256: dda36459eda6625a3506fb51281fc22231eea17f862487819cc5286f52546686

Contents?: true

Size: 567 Bytes

Versions: 152

Compression:

Stored size: 567 Bytes

Contents

module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Array #:nodoc:
      module Wrapper
        # 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 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
  end
end

Version data entries

152 entries across 121 versions & 15 rubygems

Version Path
gemstreamer-1.2.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
gemstreamer-1.1.1 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
gemstreamer-1.1.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
gemstreamer-1.0.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
gemstreamer-0.0.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
radiant-rc-0.9.0 vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
webroar-0.2.2 src/admin_panel/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
radiant-0.8.1 vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
activesupport-2.3.4 lib/active_support/core_ext/array/wrapper.rb
activesupport-2.3.3 lib/active_support/core_ext/array/wrapper.rb
activesupport-2.3.2 lib/active_support/core_ext/array/wrapper.rb
radiant-0.8.0 vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb