Sha256: c4baff020161226b53dedbf6cba482c587df5a73221f6acce7bb0ccb0b779ff6

Contents?: true

Size: 580 Bytes

Versions: 79

Compression:

Stored size: 580 Bytes

Contents

class Array

  alias_method :multiply, :*

  def *(rhs=nil)
    if rhs
      multiply(rhs)
    else
      Enumerable::MultiSender.new(self, :map)
    end
  end

  def drop_while!
    drop = 0
    drop += 1 while yield(self[drop])
    self[0..drop-1] = []
    self
  end

  # useful function from Rails 2.3
  if !respond_to? :wrap
    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

79 entries across 79 versions & 2 rubygems

Version Path
hobo_support-1.3.0.RC2 lib/hobo_support/array.rb
hobo_support-1.3.0.RC1 lib/hobo_support/array.rb
hobo_support-1.3.0.RC lib/hobo_support/array.rb
hobo_support-1.3.0.pre31 lib/hobo_support/array.rb
hobo_support-1.3.0.pre29 lib/hobo_support/array.rb
hobo_support-1.3.0.pre28 lib/hobo_support/array.rb
hobosupport-1.0.3 lib/hobo_support/array.rb
hobosupport-1.1.0.pre4 lib/hobo_support/array.rb
hobo_support-1.3.0.pre27 lib/hobo_support/array.rb
hobo_support-1.3.0.pre26 lib/hobo_support/array.rb
hobosupport-1.1.0.pre3 lib/hobo_support/array.rb
hobo_support-1.3.0.pre25 lib/hobo_support/array.rb
hobo_support-1.3.0.pre24 lib/hobo_support/array.rb
hobo_support-1.3.0.pre23 lib/hobo_support/array.rb
hobo_support-1.3.0.pre22 lib/hobo_support/array.rb
hobo_support-1.3.0.pre21 lib/hobo_support/array.rb
hobo_support-1.3.0.pre20 lib/hobo_support/array.rb
hobo_support-1.3.0.pre19 lib/hobo_support/array.rb
hobo_support-1.3.0.pre18 lib/hobo_support/array.rb
hobosupport-1.1.0.pre2 lib/hobo_support/array.rb