class Rodauth::Configuration

Attributes

auth[R]

Public Class Methods

new(auth, &block) click to toggle source
    # File lib/rodauth.rb
329 def initialize(auth, &block)
330   @auth = auth
331   # :nocov:
332   # Only for backwards compatibility
333   # RODAUTH3: Remove
334   apply(&block) if block
335   # :nocov:
336 end

Public Instance Methods

apply(&block) click to toggle source
    # File lib/rodauth.rb
338 def apply(&block)
339   load_feature(:base)
340   instance_exec(&block)
341 end
enable(*features) click to toggle source
    # File lib/rodauth.rb
343 def enable(*features)
344   features.each do |feature|
345     next if @auth.features.include?(feature)
346     load_feature(feature)
347     @auth.features << feature
348   end
349 end

Private Instance Methods

load_feature(feature_name) click to toggle source
    # File lib/rodauth.rb
353 def load_feature(feature_name)
354   require "rodauth/features/#{feature_name}" unless FEATURES[feature_name]
355   feature = FEATURES[feature_name]
356   enable(*feature.dependencies)
357   extend feature.configuration
358 
359   @auth.routes.concat(feature.routes)
360   @auth.send(:include, feature)
361 end