module Authlogic::Config

Public Class Methods

extended(klass) click to toggle source
# File lib/authlogic/config.rb, line 3
def self.extended(klass)
  klass.class_eval do
    class_attribute :acts_as_authentic_config
    self.acts_as_authentic_config ||= {}
  end
end

Private Instance Methods

rw_config(key, value, default_value = nil) click to toggle source

This is a one-liner method to write a config setting, read the config setting, and also set a default value for the setting.

# File lib/authlogic/config.rb, line 14
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