Module: T::Collectable

Included in:
CLI, List
Defined in:
lib/t/collectable.rb

Instance Method Summary collapse

Instance Method Details

#collect_with_cursor(collection = [], cursor = -1,, &block) ⇒ Object



4
5
6
7
8
# File 'lib/t/collectable.rb', line 4

def collect_with_cursor(collection=[], cursor=-1, &block)
  object = yield cursor
  collection += object.collection
  object.last? ? collection : collect_with_cursor(collection, object.next_cursor, &block)
end