Sha256: e5e2b525be63c10d16bd27a15c02455dcc40423568c9352bea9e9e5b35524887

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require 'singleton'
module Fernet
  class Configuration
    include Singleton

    # Whether to enforce a message TTL
    # (true or false)
    attr_accessor :enforce_ttl

    # How long messages are considered valid to the verifier
    # (an integer in seconds)
    attr_accessor :ttl

    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

2 entries across 2 versions & 1 rubygems

Version Path
fernet-2.0.rc1 lib/fernet/configuration.rb
fernet-1.2 lib/fernet/configuration.rb