Class: VkGroupParser::NavigableGroupManager
- Inherits:
-
Object
- Object
- VkGroupParser::NavigableGroupManager
- Defined in:
- lib/vk_group_parser/navigable_group_manager.rb
Instance Method Summary collapse
- #get_next_members ⇒ Object
- #has_next? ⇒ Boolean
-
#initialize(group_manager, per_page) ⇒ NavigableGroupManager
constructor
A new instance of NavigableGroupManager.
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_members ⇒ Object
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
10 11 12 |
# File 'lib/vk_group_parser/navigable_group_manager.rb', line 10 def has_next? @page < @all_pages_count end |