class Object

Public Instance Methods

enumerate() { |val| ... } click to toggle source
# File lib/object_enumerate.rb, line 2
def enumerate
  raise ArgumentError, "No block given" unless block_given?
  Enumerator.new do |y|
    val = self
    y << val
    loop do
      val = yield(val)
      y << val
    end
  end
end