Class: CursorPager::Base64Encoder

Inherits:
Object
  • Object
show all
Defined in:
lib/cursor_pager/base64_encoder.rb

Overview

Default encoder used to encode & decode cursors.

Class Method Summary collapse

Class Method Details

.decode(data) ⇒ Object



13
14
15
16
17
# File 'lib/cursor_pager/base64_encoder.rb', line 13

def decode(data)
  Base64.urlsafe_decode64(data)
rescue ArgumentError
  raise InvalidCursorError, data
end

.encode(data) ⇒ Object



9
10
11
# File 'lib/cursor_pager/base64_encoder.rb', line 9

def encode(data)
  Base64.urlsafe_encode64(data)
end