Class: Async::Slack::Pagination
Instance Method Summary
collapse
#initialize
Instance Method Details
#each(page: 1, count: 100, **parameters) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/async/slack/search.rb', line 30
def each(page: 1, count: 100, **parameters)
return to_enum(:each, page: page, count: count, **parameters) unless block_given?
collection = self.collection(**parameters)
while true
representation = collection.get(self.class, page: page, count: count)
records = representation.records
records.each do |value|
yield represent(representation.metadata, value)
end
break if records.count < count
page += 1
end
end
|
#empty? ⇒ Boolean
51
52
53
|
# File 'lib/async/slack/search.rb', line 51
def empty?
self.value.empty?
end
|