1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Change method from dig to deep fetch

This commit is contained in:
Suraj Shirvankar 2016-01-26 19:29:01 +04:00
parent 71c8eb38bf
commit f4064167bb

View file

@ -17,7 +17,7 @@ module Fog
end
private
def dig(hash, *path)
def deep_fetch(hash, *path)
path.inject(hash) do |acc, key|
acc.respond_to?(:keys) ? acc[key] : nil
end
@ -30,8 +30,8 @@ module Fog
end
def get_paged_links(links)
next_link = dig(links, "pages", "next").to_s
last_link = dig(links, "pages", "last").to_s
next_link = deep_fetch(links, "pages", "next").to_s
last_link = deep_fetch(links, "pages", "last").to_s
@next = get_page(next_link) || @next
@last = get_page(last_link) || @last
end