lib/warden/strategies.rb
# Add a strategy and store it in a hash.
Add a strategy and store it in a hash.
Add a strategy and store it in a hash .
def add(label, strategy = nil, &block)
        strategy ||= Class.new(Warden::Strategies::Base)
        strategy.class_eval(&block) if block_given?
        unless strategy.method_defined?(:authenticate!)
          raise NoMethodError, "authenticate! is not declared in the #{label.inspect} strategy"
        end
        base = Warden::Strategies::Base
        unless strategy.ancestors.include?(base)
          raise "#{label.inspect} is not a #{base}"
        end
        _strategies[label] = strategy
      end
def add ( label , strategy = nil , & block ) strategy ||= Class . new ( Warden :: Strategies :: Base ) strategy . class_eval ( & block ) if block_given? unless strategy . method_defined? ( :authenticate! ) raise NoMethodError , "authenticate! is not declared in the #{label.inspect} strategy" end base = Warden :: Strategies :: Base unless strategy . ancestors . include? ( base ) raise "#{label.inspect} is not a #{base}" end _strategies [ label ] = strategy end
Add a strategy and store it in a hash.
Add a strategy and store it in a hash .
label
<not_specific>
strategy
<not_specific>
block
<not_specific>