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
hobosupport-1.1.0.pre0 lib/hobo_support/array.rb
hobosupport-1.0.2 lib/hobo_support/array.rb
hobo_support-1.3.0.pre16 lib/hobo_support/array.rb
hobo_support-1.3.0.pre15 lib/hobo_support/array.rb
hobo_support-1.3.0.pre14 lib/hobo_support/array.rb
hobo_support-1.3.0.pre13 lib/hobo_support/array.rb
hobo_support-1.3.0.pre12 lib/hobo_support/array.rb
hobo_support-1.3.0.pre11 lib/hobo_support/array.rb
hobo_support-1.3.0.pre10 lib/hobo_support/array.rb
hobosupport-1.0.1 lib/hobo_support/array.rb
hobosupport-1.0.0 lib/hobo_support/array.rb
hobosupport-0.9.106 lib/hobo_support/array.rb
hobosupport-0.9.105 lib/hobo_support/array.rb
hobosupport-0.9.104 lib/hobo_support/array.rb
hobosupport-0.9.103 lib/hobo_support/array.rb
hobosupport-0.9.102 lib/hobo_support/array.rb
hobosupport-0.9.101 lib/hobo_support/array.rb
hobosupport-0.9.100 lib/hobo_support/array.rb
hobosupport-0.9.0 lib/hobo_support/array.rb