Class: Collective::Configuration::PoolEnumerator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/collective/configuration.rb

Overview

I’m not sure why this is so complicated.

Instance Method Summary collapse

Constructor Details

#initialize(pools) ⇒ PoolEnumerator

Returns a new instance of PoolEnumerator.



87
88
89
# File 'lib/collective/configuration.rb', line 87

def initialize pools
  @pools = pools
end

Instance Method Details

#each(&block) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/collective/configuration.rb', line 91

def each(&block)
  them = @pools.each
  it = nil
  loop do
    begin
      it = them.next
    rescue StopIteration => x
      break
    end
    policy = Collective::Policy.resolve(it.last)
    yield([ it.first, policy ])
  end
end