Module: FacebookAds::EdgeHasGet
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/facebook_ads/edge.rb
Constant Summary collapse
- DEFAULT_PAGE_SIZE =
10
Instance Attribute Summary collapse
-
#has_next_page ⇒ Object
Returns the value of attribute has_next_page.
-
#next_page_cursor ⇒ Object
Returns the value of attribute next_page_cursor.
Instance Method Summary collapse
Instance Attribute Details
#has_next_page ⇒ Object
Returns the value of attribute has_next_page.
15 16 17 |
# File 'lib/facebook_ads/edge.rb', line 15 def has_next_page @has_next_page end |
#next_page_cursor ⇒ Object
Returns the value of attribute next_page_cursor.
15 16 17 |
# File 'lib/facebook_ads/edge.rb', line 15 def next_page_cursor @next_page_cursor end |
Instance Method Details
#[](idx) ⇒ Object
17 18 19 20 21 |
# File 'lib/facebook_ads/edge.rb', line 17 def [](idx) # TODO Handle delegate fetch_next_page until idx < collection.length || !has_next_page? collection[idx] end |
#all ⇒ Object
23 24 25 26 |
# File 'lib/facebook_ads/edge.rb', line 23 def all fetch_next_page until !has_next_page? collection end |
#each ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/facebook_ads/edge.rb', line 28 def each return enum_for(:each) unless block_given? idx = 0 while (e = self[idx]) yield e idx += 1 end self end |
#reload! ⇒ Object
41 42 43 44 45 |
# File 'lib/facebook_ads/edge.rb', line 41 def reload! @collection = Array.new self.has_next_page = true self.next_page_cursor = nil end |