module Enumerable

Public Instance Methods

*() click to toggle source
# File lib/hobo_support/enumerable.rb, line 51
def *()
  MultiSender.new(self, :map)
end
build_hash(res={}) { |x| ... } click to toggle source
# File lib/hobo_support/enumerable.rb, line 16
def build_hash(res={})
  each do |x|
    pair = block_given? ? yield(x) : x
    res[pair.first] = pair.last if pair
  end
  res
end
drop_while() { |self| ... } click to toggle source
# File lib/hobo_support/enumerable.rb, line 64
def drop_while
  drop = 0
  drop += 1 while yield(self[drop])
  self[drop..-1]
end
map_and_find(not_found=nil) { |x| ... } click to toggle source
# File lib/hobo_support/enumerable.rb, line 3
def map_and_find(not_found=nil)
  each do |x|
    val = yield(x)
    return val if val
  end
  not_found
end
map_hash(res={}) { |x| ... } click to toggle source
# File lib/hobo_support/enumerable.rb, line 24
def map_hash(res={})
  each do |x|
    v = yield x
    res[x] = v
  end
  res
end
map_with_index(res=[]) { |x, i| ... } click to toggle source
# File lib/hobo_support/enumerable.rb, line 11
def map_with_index(res=[])
  each_with_index {|x, i| res << yield(x, i)}
  res
end
rest() click to toggle source
# File lib/hobo_support/enumerable.rb, line 32
def rest
  self[1..-1] || []
end
take_while() { |self| ... } click to toggle source
# File lib/hobo_support/enumerable.rb, line 73
def take_while
  take = 0
  take += 1 while yield(self[take])
  self[0..take-1]
end
where() click to toggle source
# File lib/hobo_support/enumerable.rb, line 55
def where
  MultiSender.new(self, :select)
end
where_not() click to toggle source
# File lib/hobo_support/enumerable.rb, line 59
def where_not
  MultiSender.new(self, :reject)
end