class CooCoo::Transformers::Stopper

Public Class Methods

new(enum, n) click to toggle source
Calls superclass method CooCoo::Transformers::Proxy::new
# File lib/coo-coo/transformer.rb, line 54
def initialize(enum, n)
  @stop_after = n
  @index = 0

  super(enum)
end

Public Instance Methods

next() click to toggle source
Calls superclass method CooCoo::Transformers::Proxy#next
# File lib/coo-coo/transformer.rb, line 61
def next
  if @index < @stop_after
    @index += 1
    super
  else
    raise StopIteration
  end
end