Module: EventMachine::IteratorWithArray

Included in:
Iterator
Defined in:
lib/patch/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)


80
81
82
# File 'lib/patch/iterator.rb', line 80

def next?
  @list.any?
end

#next_itemObject



76
77
78
# File 'lib/patch/iterator.rb', line 76

def next_item
  @list.shift
end

#setup_list(list) ⇒ Object

Raises:

  • (ArgumentError)


71
72
73
74
# File 'lib/patch/iterator.rb', line 71

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