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
depengine-0.0.22 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.21 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.21 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.20 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.20 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.19 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.19 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.18 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.18 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.17 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.17 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.16 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.16 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.15 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.15 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.14 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.14 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.13 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb
depengine-0.0.13 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/wrapper.rb