Module: EventMachine::IteratorWithArray

Included in:
Iterator
Defined in:
lib/em/iterator.rb

Overview

Ruby 1.8 uses continuations in Enumerable, so we should use Arrays

Instance Method Summary collapse

Instance Method Details

#next?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
# File 'lib/em/iterator.rb', line 56

def next?
  any = @list.any?
  @next_item = @list.shift
  any
end

#setup_list(list) ⇒ Object

Raises:

  • (ArgumentError)


51
52
53
54
# File 'lib/em/iterator.rb', line 51

def setup_list(list)
  raise ArgumentError, 'argument must be an array' unless list.respond_to?(:to_a)
  list.dup.to_a
end