lib/uploadcare/entity/decorator/paginator.rb
# Attempts to load the entire list after offset into results of current object
#
# It's possible to avoid loading objects on previous pages by offsetting them first
Attempts to load the entire list after offset into results of current object
It's possible to avoid loading objects on previous pages by offsetting them first
Attempts to load the entire list after offset into results of current object It ' s possible to avoid loading objects on previous pages by offsetting them first
def load
          return self if @entity[:next].nil? || @entity[:results].length == @entity[:total]
          np = self
          until np.next.nil?
            np = np.next_page
            @entity[:results].concat(np.results.map(&:to_h))
          end
          @entity[:next] = nil
          @entity[:per_page] = @entity[:total]
          self
        end
def load return self if @entity [ :next ] . nil? || @entity [ :results ] . length == @entity [ :total ] np = self until np . next . nil? np = np . next_page @entity [ :results ] . concat ( np . results . map ( & :to_h ) ) end @entity [ :next ] = nil @entity [ :per_page ] = @entity [ :total ] self end
Attempts to load the entire list after offset into results of current object
It's possible to avoid loading objects on previous pages by offsetting them first
Attempts to load the entire list after offset into results of current object It ' s possible to avoid loading objects on previous pages by offsetting them first