Method: Plurall::Administrators#all

Defined in:
lib/plurall/administrators.rb

#all(&block) ⇒ Object

Public: Iterates all administrators.

Several API calls may be made to retrieve all by repeatedly calling #next until #next? returns ‘false`.

Examples

Plurall.administrators(school_id: 123456).all do |administrator|
  puts administrator.name
end

Yields an administrator object to the block.

Returns an Enumerator when no block argument is given, or nothing when when a block argument is given.



78
79
80
81
82
83
84
85
86
87
# File 'lib/plurall/administrators.rb', line 78

def all &block
  return enum_for :all unless block

  page = self
  loop do
    page.each(&block)
    page = page.next
    break if page.nil?
  end
end