Class: VkGroupParser::NavigableGroupManager

Inherits:
Object
  • Object
show all
Defined in:
lib/vk_group_parser/navigable_group_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(group_manager, per_page) ⇒ NavigableGroupManager

Returns a new instance of NavigableGroupManager.



3
4
5
6
7
8
# File 'lib/vk_group_parser/navigable_group_manager.rb', line 3

def initialize(group_manager, per_page)
  @group_manager = group_manager
  @all_pages_count = calc_all_pages_count(group_manager, per_page)
  @per_page = per_page
  @page = 0
end

Instance Method Details

#get_next_membersObject



14
15
16
17
18
# File 'lib/vk_group_parser/navigable_group_manager.rb', line 14

def get_next_members
  p = @page
  @page += 1
  @group_manager.get_members(@per_page, @per_page * p)[:items]
end

#has_next?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/vk_group_parser/navigable_group_manager.rb', line 10

def has_next?
  @page < @all_pages_count
end