# frozen_string_literal: true module AuthStrategist module StrategyInterface def self.included(base) base.class_eval do extend Dry::Initializer end def base.define_components(*components) components.each do |component| option component, optional: true end end def base.components dry_initializer.definitions.keys end end def authorized? raise( AuthStrategist::Errors::AuthorizedNotImplemented, "#{self.class}#authorized? was not implemented." ) end def authorize! raise unauthorized unless authorized? end def unauthorized AuthStrategist::Errors::Unauthorized end end end