Method: Mobility::Plugin#requires
- Defined in:
- lib/mobility/plugin.rb
#requires(plugin, include: true) ⇒ Object
Specifies a dependency of this plugin.
By default, the dependency is included (include: true). Passing :before or :after will ensure the dependency is included before or after this plugin.
Passing false does not include the dependency, but checks that it has been included when running include and initialize hooks (so hooks will not run for this plugin if it has not been included). In other words: disable this plugin unless this dependency has been included elsewhere. (Note that this check is not applied recursively.)
143 144 145 146 147 148 |
# File 'lib/mobility/plugin.rb', line 143 def requires(plugin, include: true) unless [true, false, :before, :after].include?(include) raise ArgumentError, "requires 'include' keyword argument must be one of: true, false, :before or :after" end dependencies[plugin] = include end |