Module: Leadlight::EnumerableRepresentation

Defined in:
lib/leadlight/enumerable_representation.rb

Constant Summary collapse

Tint =
Tint.new('EnumerableRepresentation') do
  match_class(Enumerable)
  extend(EnumerableRepresentation)
end

Instance Method Summary collapse

Instance Method Details

#each(call_super = false, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/leadlight/enumerable_representation.rb', line 8

def each(call_super=false,&block)
  if call_super
    return super(&block)
  end

  page = self
  loop do
    page.each(true, &block)
    if (next_link = page.link('next'){nil})
      page = next_link.follow
    else
      break
    end
  end
end