Module: Metasploit::Concern
- Defined in:
- lib/metasploit/concern.rb,
lib/metasploit/concern/engine.rb,
lib/metasploit/concern/version.rb
Overview
Automates the inclusion of concerns into classes and models from other ‘Rail::Engine`s by use of an app/concerns directory in the `Rails::Engine` that declares the concerns.
The ‘Class` or `Module` must support the use of concerns by calling Concern.run.
To include concerns from a Rails::Application add ‘app/concerns’ to paths and then declare concerns under app/concerns.
To include concerns from a Rails::Engine add ‘app/concerns’ to the paths and then declare concerns under app/concerns.
Defined Under Namespace
Modules: Version Classes: Engine, Loader
Constant Summary collapse
Class Method Summary collapse
-
.root ⇒ Pathname
The root of the ‘metasploit-concern` gem’s file tree.
-
.run(klass) ⇒ void
initializer registering all the load hooks as any late load hooks will run as they are registered.
Class Method Details
.root ⇒ Pathname
If ‘Rails` is loaded and Engine is defined, just use `Metasploit::Concern::Engine.root`.
The root of the ‘metasploit-concern` gem’s file tree.
87 88 89 |
# File 'lib/metasploit/concern.rb', line 87 def self.root @root ||= Pathname.new(__FILE__).parent.parent.parent end |
.run(klass) ⇒ void
As ‘ActiveSupport.run_load_hooks` is used, it is safe to call run prior to Metasploit::Concern’s
‘klass` must have a `Module#name` so that the load hook symbol can be derived.
This method returns an undefined value.
initializer registering all the load hooks as any late load hooks will run as they are registered.
Runs the load hooks setup to include app/concerns concerns this ‘klass`.
101 102 103 104 |
# File 'lib/metasploit/concern.rb', line 101 def self.run(klass) load_hook_name = klass.name.underscore.gsub('/', '_').to_sym ActiveSupport.run_load_hooks(load_hook_name, klass) end |