Method: Graphiti::Query#pagination

Defined in:
lib/graphiti/query.rb

#paginationObject



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/graphiti/query.rb', line 168

def pagination
  @pagination ||= begin
    {}.tap do |hash|
      (@params[:page] || {}).each_pair do |name, value|
        if legacy_nested?(name)
          value.each_pair do |k, v|
            hash[k.to_sym] = v.to_i
          end
        elsif nested?(name)
          hash[name.to_s.split(".").last.to_sym] = value
        elsif top_level? && [:number, :size].include?(name.to_sym)
          hash[name.to_sym] = value.to_i
        end
      end
    end
  end
end