class Rodauth::Model

def self.associations

def self.associations
  @associations ||= {}
end

def self.register_association(feature, &block)

def self.register_association(feature, &block)
  associations[feature] ||= []
  associations[feature] << block
end

def feature_associations

def feature_associations
  self.class.associations
    .values_at(*rodauth.features)
    .compact
    .flatten
    .map { |block| rodauth.instance_exec(&block) }
end

def included(model)

def included(model)
  if defined?(::ActiveRecord::Base) && model < ::ActiveRecord::Base
    extend Rodauth::Model::ActiveRecord
  elsif defined?(::Sequel::Model) && model < ::Sequel::Model
    extend Rodauth::Model::Sequel
  else
    raise Error, "must be an Active Record or Sequel model"
  end
  define_associations(model)
  define_methods(model)
end

def initialize(auth_class, association_options: {})

def initialize(auth_class, association_options: {})
  @auth_class = auth_class
  @association_options = association_options
end

def inspect

def inspect
  "#<#{self.class}(#{@auth_class.inspect})>"
end

def rodauth

def rodauth
  @auth_class.allocate
end