Method: Foliate::Pagination#each_query_param

Defined in:
lib/foliate/pagination.rb

#each_query_param {|name, value| ... } ⇒ nil #each_query_paramEnumerator

Iterates through each #query_params as name-value pairs. Nested Hashes and Arrays are iterated as well. The name of nested a value will reflect its nesting in the same way as when converting a nested Hash to a query string via Hash#to_query. Intended for use when generating form fields.

If no block is given, an Enumerator is returned.

Overloads:

  • #each_query_param {|name, value| ... } ⇒ nil

    Yield Parameters:

    • name (String)
    • value (String)


65
66
67
68
69
70
71
72
73
74
# File 'lib/foliate/pagination.rb', line 65

def each_query_param
  if block_given?
    ParamsHelper.to_keyed_pairs(query_params).each do |pair|
      yield pair[:name], pair[:value]
    end
    nil
  else
    to_enum(__method__)
  end
end