class Fog::Compute::DigitalOceanV2::PagingCollection

Public Instance Methods

next_page() click to toggle source
# File lib/fog/digitalocean/models/paging_collection.rb, line 9
def next_page
  all(page: @next) if @next != @last
end
previous_page() click to toggle source
# File lib/fog/digitalocean/models/paging_collection.rb, line 13
def previous_page
  if @next.to_i > 2
    all(page: @next.to_i - 2)
  end
end

Private Instance Methods

deep_fetch(hash, *path) click to toggle source
# File lib/fog/digitalocean/models/paging_collection.rb, line 20
def deep_fetch(hash, *path)
  path.inject(hash) do |acc, key|
    acc.respond_to?(:keys) ? acc[key] : nil
  end
end
get_page(link) click to toggle source
# File lib/fog/digitalocean/models/paging_collection.rb, line 26
def get_page(link)
  if match = link.match(/page=(?<page>\d+)/)
    match.captures.last
  end
end