Module: BooticClient::EnumerableEntity

Includes:
Enumerable
Defined in:
lib/bootic_client/entity.rb

Instance Method Summary collapse

Instance Method Details

#each(&block) ⇒ Object


9
10
11
# File 'lib/bootic_client/entity.rb', line 9

def each(&block)
  self[:items].each &block
end

#full_setObject


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bootic_client/entity.rb', line 13

def full_set
  page = self

  Enumerator.new do |yielder|
    loop do
      page.each{|item| yielder.yield item }
      raise StopIteration unless page.has_rel?(:next)
      page = page.next
    end
  end
end