Class: Pyper::Pipes::Cassandra::PaginationDecoding

Inherits:
Object
  • Object
show all
Defined in:
lib/pyper/pipes/cassandra/pagination_decoding.rb

Overview

This pipe extracts an encoded paging_state, decodes it, and passes on a decoded paging state. This pipe is intended to be used before the Cassandra::Reader pipe, as that pipe can interpret the :paging_state argument.

This pipe pairs with the PaginationEncoding pipe, which performs the reverse transformation

Instance Method Summary collapse

Instance Method Details

#pipe(args, status = {}) ⇒ Hash

Returns The list of arguments with :paging_state decoded, if present.

Parameters:

  • args (Hash)

    Arguments that include an encoded :paging_state

  • status (Hash) (defaults to: {})

    The mutable status field

Returns:

  • (Hash)

    The list of arguments with :paging_state decoded, if present



16
17
18
19
20
# File 'lib/pyper/pipes/cassandra/pagination_decoding.rb', line 16

def pipe(args, status = {})
  page_state = args[:paging_state]
  args[:paging_state] = Base64.urlsafe_decode64(page_state) if page_state
  args
end