Module: Async::Background::Web::Cursor

Defined in:
lib/async/background/web/cursor.rb

Class Method Summary collapse

Class Method Details

.decode_finished(value) ⇒ Object



19
# File 'lib/async/background/web/cursor.rb', line 19

def decode_finished(value) = decode_as(:finished_at, value)

.decode_pending(value) ⇒ Object



20
# File 'lib/async/background/web/cursor.rb', line 20

def decode_pending(value) = decode_as(:run_at, value)

.encode(timestamp, id) ⇒ Object



11
12
13
14
15
# File 'lib/async/background/web/cursor.rb', line 11

def encode(timestamp, id)
  return if timestamp.nil? || id.nil?

  Base64.urlsafe_encode64("#{Float(timestamp)}:#{Integer(id)}", padding: false)
end

.encode_finished(finished_at, id) ⇒ Object



17
# File 'lib/async/background/web/cursor.rb', line 17

def encode_finished(finished_at, id) = encode(finished_at, id)

.encode_pending(run_at, id) ⇒ Object



18
# File 'lib/async/background/web/cursor.rb', line 18

def encode_pending(run_at, id) = encode(run_at, id)