module AuthStrategist module StrategyInterface def self.included(base) base.class_eval do class << self def define_components(*defined_components) defined_components.delete_if { |c| default_components.include?(c) } defined_components.uniq! attr_accessor(*defined_components) @components = defined_components end def components [*default_components, *@components] end def default_components AuthStrategist.configuration.default_strategy_components.uniq end end attr_accessor(*components) def initialize(attributes = {}) assign_component_values(attributes) end def components self.class.components end def authorize! warn("#{self.class}#authorize! was not implemented.") end private def assign_component_values(attributes = {}) components.each do |c| instance_variable_set("@#{c}", attributes[c]) end end end end end end