Sha256: fb2dd0f498c69987fe07db448b131cee52cfa53820a46a2decbe41e34bbd2a9e
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
require 'singleton' module Fernet # Public: singleton class used to globally set various # configuration defaults class Configuration include Singleton # Public: Returns whether to enforce a message TTL (true or false) attr_accessor :enforce_ttl # Public: Returns how many seconds messages are considered valid for attr_accessor :ttl # Public: used to configure fernet, typically invoked in an initialization # routine # # Sets the following values: # # * enforce_ttl: true # * ttl: 60 # # Yields the singleton configuration object, where above defaults can be # overridden # # Examples # # Fernet::Configuration.run do |config| # config.enforce_ttl = false # end def self.run self.instance.enforce_ttl = true self.instance.ttl = 60 yield self.instance if block_given? end class << self def method_missing(method) if self.instance.respond_to?(method) self.instance.send(method) else super end end def respond_to?(method) self.instance.respond_to?(method) || super end end end end
Version data entries
5 entries across 5 versions & 1 rubygems