Sha256: 4aa392b9f19d50a21fb6da06b32f2caf3d0153b8682124cc589162ab81fdbcc2

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 Bytes

Contents

# encoding: utf-8
module Authlogic
  module Config
    def self.extended(klass)
      klass.class_eval do
        class_attribute :acts_as_authentic_config
        self.acts_as_authentic_config ||= {}
      end
    end

    private

      # This is a one-liner method to write a config setting, read the config
      # setting, and also set a default value for the setting.
      def rw_config(key, value, default_value = nil)
        if value.nil?
          acts_as_authentic_config.include?(key) ? acts_as_authentic_config[key] : default_value
        else
          self.acts_as_authentic_config = acts_as_authentic_config.merge(key => value)
          value
        end
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
authlogic-3.8.0 lib/authlogic/config.rb
authlogic-3.7.0 lib/authlogic/config.rb
authlogic-3.6.1 lib/authlogic/config.rb
authlogic-3.6.0 lib/authlogic/config.rb
authlogic-3.5.0 lib/authlogic/config.rb