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.



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

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.



376
377
378
# File 'lib/rodauth.rb', line 376

def auth
  @auth
end

Instance Method Details

#apply(&block) ⇒ Object



387
388
389
390
# File 'lib/rodauth.rb', line 387

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

#enable(*features) ⇒ Object



392
393
394
395
396
397
398
# File 'lib/rodauth.rb', line 392

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