Sha256: 7d407b460af403ecd13d2adc8abda7705a7c411226b734ec131ecfe8f34fb3c1

Contents?: true

Size: 1.35 KB

Versions: 18

Compression:

Stored size: 1.35 KB

Contents

require 'active_support/core_ext/module/delegation'

# Allows modules to be configured (using {Metasploit::Model::Configuration}) similar to Rails engines.
#
# @example Making gem module configurable
#   module MyGem
#     extend Metasploit::Model::Configured
#
#     # assumes __FILE__ is lib/my_gem.rb
#     lib_my_gem_pathname = Pathname.new(___FILE__)
#     lib_pathname = lib_my_gem_pathname.parent
#     configuration.root = lib_pathname.parent
#
#     configuration.autoload.paths << 'app/models'
#   end
#
#   # registers 'app/models' as an autoload_path with ActiveSupport::Dependencies
#   MyGem.setup
module Metasploit::Model::Configured
  # The {Metasploit::Model::Configuration} for this configured `Module`.
  #
  # @return [Metasploit::Model::Configuration]
  def configuration
    unless instance_variable_defined? :@configuration
      require 'metasploit/model/configuration'

      @configuration = Metasploit::Model::Configuration.new
    end

    @configuration
  end

  # @!method root
  #   The configured root.
  #
  #   @return (see Metasploit::Model::Configuration#root)
  #
  # @!method setup
  #   Sets up the autoload and i18n paths for the configured gem.
  #
  #   @return (see Metasploit::Model::Configuration.setup)
  #   @raise (see Metasploit::Model::Configuration.setup)
  delegate :root,
           :setup,
           to: :configuration
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
metasploit-model-0.27.0.pre.dep.pre.railties lib/metasploit/model/configured.rb
metasploit-model-0.26.1-java lib/metasploit/model/configured.rb
metasploit-model-0.26.1 lib/metasploit/model/configured.rb
metasploit-model-0.25.7 lib/metasploit/model/configured.rb
metasploit-model-0.25.7-java lib/metasploit/model/configured.rb
metasploit-model-0.25.6 lib/metasploit/model/configured.rb
metasploit-model-0.25.6-java lib/metasploit/model/configured.rb
metasploit-model-0.25.3 lib/metasploit/model/configured.rb
metasploit-model-0.25.3-java lib/metasploit/model/configured.rb
metasploit-model-0.25.2 lib/metasploit/model/configured.rb
metasploit-model-0.25.2-java lib/metasploit/model/configured.rb
metasploit-model-0.25.1 lib/metasploit/model/configured.rb
metasploit-model-0.25.1-java lib/metasploit/model/configured.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups-java lib/metasploit/model/configured.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups lib/metasploit/model/configured.rb
metasploit-model-0.24.1-java lib/metasploit/model/configured.rb
metasploit-model-0.24.1 lib/metasploit/model/configured.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 lib/metasploit/model/configured.rb