Provides access to strategies by label :api: public
# File lib/warden/strategies.rb, line 30 def [](label) _strategies[label] end
:api: private
# File lib/warden/strategies.rb, line 41 def _strategies @strategies ||= {} end
Add a strategy and store it in a hash.
# File lib/warden/strategies.rb, line 5 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
Generated with the Darkfish Rdoc Generator 2.