Class: Pyper::Pipes::Cassandra::PaginationEncoding

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

Overview

Given a :paging_state in the status field, encodes it. This is the reverse transformation of the PaginationDecoding pipe.

Instance Method Summary collapse

Instance Method Details

#pipe(items, status) ⇒ Enumerable<Hash>

Returns The unchanged list of items.

Parameters:

  • items (Enumerable<Hash>)
  • status (Hash)

    The mutable status field

Returns:

  • (Enumerable<Hash>)

    The unchanged list of items



11
12
13
14
15
# File 'lib/pyper/pipes/cassandra/pagination_encoding.rb', line 11

def pipe(items, status)
  page_state = status[:paging_state]
  status[:paging_state] = Base64.urlsafe_encode64(page_state) if page_state
  items
end