Sha256: dab71361ccd359ce67ed4ccab4e5bfdd25d56238c812afa4a203387994a09586

Contents?: true

Size: 902 Bytes

Versions: 3

Compression:

Stored size: 902 Bytes

Contents

module Clearance
  class Configuration
    attr_accessor :mailer_sender, :cookie_expiration, :password_strategy

    def initialize
      @mailer_sender     = 'donotreply@example.com'
      @cookie_expiration = lambda { 1.year.from_now.utc }
    end
  end

  class << self
    attr_accessor :configuration
  end

  # Configure Clearance someplace sensible,
  # like config/initializers/clearance.rb
  #
  # If you want users to only be signed in during the current session
  # instead of being remembered, do this:
  #
  #   config.cookie_expiration = lambda { }
  #
  # @example
  #   Clearance.configure do |config|
  #     config.mailer_sender     = 'me@example.com'
  #     config.cookie_expiration = lambda { 2.weeks.from_now.utc }
  #     config.password_strategy = MyPasswordStrategy
  #   end
  def self.configure
    self.configuration ||= Configuration.new
    yield(configuration)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clearance-0.14.0 lib/clearance/configuration.rb
clearance-0.13.2 lib/clearance/configuration.rb
clearance-0.13.0 lib/clearance/configuration.rb