module DeviseCasAuthenticatable::SingleSignOut::Strategies
Public Class Methods
[](label)
click to toggle source
Provides access to strategies by label
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 30 def [](label) _strategies[label] end
add(label, strategy, &block)
click to toggle source
Add a strategy and store it in a hash.
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 7 def add(label, strategy, &block) strategy ||= Class.new(DeviseCasAuthenticatable::SingleSignOut::Strategies::Base) strategy.class_eval(&block) if block_given? check_method(label, strategy, :store_session_id_for_index) check_method(label, strategy, :find_session_id_by_index) check_method(label, strategy, :delete_session_index) unless strategy.ancestors.include?(DeviseCasAuthenticatable::SingleSignOut::Strategies::Base) raise "#{label.inspect} is not a #{base}" end _strategies[label] = strategy.new() end
clear!()
click to toggle source
Clears all declared.
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 39 def clear! _strategies.clear end
current_strategy()
click to toggle source
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 34 def current_strategy self[::Devise.cas_single_sign_out_mapping_strategy] end
update(label, &block)
click to toggle source
Update a previously given strategy.
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 23 def update(label, &block) strategy = _strategies[label] raise "Unknown strategy #{label.inspect}" unless strategy add(label, strategy, &block) end
Private Class Methods
_strategies()
click to toggle source
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 45 def _strategies @strategies ||= {} end
check_method(label, strategy, method)
click to toggle source
# File lib/devise_cas_authenticatable/single_sign_out/strategies.rb, line 49 def check_method(label, strategy, method) unless strategy.method_defined?(method) raise NoMethodError, "#{method.to_s} is not declared in the #{label.inspect} strategy" end end