Class: JWT::Encode

Inherits:
Object
  • Object
show all
Defined in:
lib/jwt/encode.rb

Overview

Encoding logic for JWT

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Encode

Returns a new instance of Encode.



9
10
11
12
13
14
# File 'lib/jwt/encode.rb', line 9

def initialize(options)
  @payload          = options[:payload]
  @key              = options[:key]
  @algorithm        = JWA.resolve(options[:algorithm])
  @headers          = options[:headers].transform_keys(&:to_s)
end

Instance Method Details

#segmentsObject



16
17
18
19
# File 'lib/jwt/encode.rb', line 16

def segments
  validate_claims!
  combine(encoded_header_and_payload, encoded_signature)
end