Method: ActiveSecurity::Configuration#_use

Defined in:
lib/active_security/configuration.rb

#_use(mod, idx) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



81
82
83
84
85
86
87
88
89
90
# File 'lib/active_security/configuration.rb', line 81

def _use(mod, idx, &block)
  mod.setup(@model_class) if mod.respond_to?(:setup)
  @model_class.send(:include, mod) unless uses?(mod)
  # Only yield on the first module, so as to not run the block multiple times,
  # and because later modules may require the attributes of a prior module to exist.
  # The block structure won't work for more complex config than that.
  # For more complex configuration pass a Hash where the keys are the "modules"
  yield self if block_given? && idx.zero?
  mod.after_config(@model_class) if mod.respond_to?(:after_config)
end