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.



376
377
378
379
380
381
382
383
# File 'lib/rodauth.rb', line 376

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.



374
375
376
# File 'lib/rodauth.rb', line 374

def auth
  @auth
end

Instance Method Details

#apply(&block) ⇒ Object



385
386
387
388
# File 'lib/rodauth.rb', line 385

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

#enable(*features) ⇒ Object



390
391
392
393
394
395
396
# File 'lib/rodauth.rb', line 390

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