Class: Fernet::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/fernet/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#encryptObject

Whether to encrypt the payload (true or false)



16
17
18
# File 'lib/fernet/configuration.rb', line 16

def encrypt
  @encrypt
end

#enforce_ttlObject

Whether to enforce a message TTL (true or false)



8
9
10
# File 'lib/fernet/configuration.rb', line 8

def enforce_ttl
  @enforce_ttl
end

#ttlObject

How long messages are considered valid to the verifier (an integer in seconds)



12
13
14
# File 'lib/fernet/configuration.rb', line 12

def ttl
  @ttl
end

Class Method Details

.method_missing(method) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fernet/configuration.rb', line 26

def method_missing(method)
  if self.instance.respond_to?(method)
    self.instance.send(method)
  else
    super
  end
end

.respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fernet/configuration.rb', line 34

def respond_to?(method)
  self.instance.respond_to?(method) || super
end

.run {|self.instance| ... } ⇒ Object

Yields:

  • (self.instance)


18
19
20
21
22
23
# File 'lib/fernet/configuration.rb', line 18

def self.run
  self.instance.enforce_ttl = true
  self.instance.ttl         = 60
  self.instance.encrypt     = true
  yield self.instance if block_given?
end