Method: Auth::Configuration.register_behavior

Defined in:
lib/auth/configuration.rb

.register_behavior(name, behavior_class = lookup_behavior(name)) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/auth/configuration.rb', line 53

def register_behavior(name, behavior_class = lookup_behavior(name))
  # If the behavior has a configuration, add it to self.
  accessor_name = name
  name = "#{behavior_class.name}::Configuration"
  # we do this so that we can raise NameError now, not later.
  behavior_configs << [ accessor_name, name.constantize.name ]
  # eg Auth.remember_me.something = 5
  Auth.class.delegate accessor_name, :to => :configuration
rescue NameError
  # Presumably, the behavior does not have a configuration.
end