Class: Rodauth::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rodauth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth, &block) ⇒ Configuration

Returns a new instance of Configuration.



331
332
333
334
335
336
337
338
# File 'lib/rodauth.rb', line 331

def initialize(auth, &block)
  @auth = auth
  # :nocov:
  # Only for backwards compatibility
  # RODAUTH3: Remove
  apply(&block) if block
  # :nocov:
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



329
330
331
# File 'lib/rodauth.rb', line 329

def auth
  @auth
end

Instance Method Details

#apply(&block) ⇒ Object



340
341
342
343
# File 'lib/rodauth.rb', line 340

def apply(&block)
  load_feature(:base)
  instance_exec(&block)
end

#enable(*features) ⇒ Object



345
346
347
348
349
350
351
# File 'lib/rodauth.rb', line 345

def enable(*features)
  features.each do |feature|
    next if @auth.features.include?(feature)
    load_feature(feature)
    @auth.features << feature
  end
end