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.



355
356
357
358
359
360
361
362
# File 'lib/rodauth.rb', line 355

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.



353
354
355
# File 'lib/rodauth.rb', line 353

def auth
  @auth
end

Instance Method Details

#apply(&block) ⇒ Object



364
365
366
367
# File 'lib/rodauth.rb', line 364

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

#enable(*features) ⇒ Object



369
370
371
372
373
374
375
# File 'lib/rodauth.rb', line 369

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