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-2.2.6 lib/hobo_support/array.rb
hobo_support-2.2.5 lib/hobo_support/array.rb
hobo_support-2.2.4 lib/hobo_support/array.rb
hobo_support-2.2.3 lib/hobo_support/array.rb
hobo_support-2.2.2 lib/hobo_support/array.rb
hobo_support-2.2.1 lib/hobo_support/array.rb
hobo_support-2.2.0 lib/hobo_support/array.rb
hobo_support-2.1.2 lib/hobo_support/array.rb
hobo_support-2.1.1 lib/hobo_support/array.rb
hobo_support-2.1.0 lib/hobo_support/array.rb
hobo_support-2.1.0.pre4 lib/hobo_support/array.rb
hobo_support-2.1.0.pre3 lib/hobo_support/array.rb
hobo_support-2.1.0.pre2 lib/hobo_support/array.rb
hobo_support-2.1.0.pre1 lib/hobo_support/array.rb
hobo_support-2.0.1 lib/hobo_support/array.rb
hobo_support-2.0.0 lib/hobo_support/array.rb
hobo_support-2.0.0.pre10 lib/hobo_support/array.rb
hobo_support-2.0.0.pre9 lib/hobo_support/array.rb
hobo_support-2.0.0.pre8 lib/hobo_support/array.rb
hobo_support-1.3.3 lib/hobo_support/array.rb