Sha256: a3b181cc42550bb9e65c9aa6442c7031dbdef47d577558cc0507c6d4ad9ab3e2

Contents?: true

Size: 1.67 KB

Versions: 18

Compression:

Stored size: 1.67 KB

Contents

# @note This can't be a model in app/models because it is used to setup the autoload_path to app/models.
#
# Configuration for a gem's autoload and i18n load paths that works outside of the railties or rails engines systems.
class Metasploit::Model::Configuration
  # no autoload paths yet, so have to explicitly require
  require 'metasploit/model/configuration/parent'
  extend Metasploit::Model::Configuration::Parent

  #
  # Attributes
  #

  # @!attribute [rw] root
  #   The root of the gem.  All relative paths are resolved relative to {#root}.
  #
  #   @return [Pathname]

  #
  # Children
  #

  # @!macro [attach] child
  #   @!attribute [rw] $1_class
  #     The `Class` used to create {#$1}.
  #
  #     @return [Class]
  #
  #   @!method $1
  #     The $1 configuration.
  #
  #     @return [Object] an instance of {#$1_class}
  #
  #   @!method $1_class
  #     The `Class` used to create {#$1}.
  #
  #     @return [Class]
  child :autoload
  child :i18n

  #
  # Methods
  #

  # The root of the gem.
  #
  # @return [Pathname] root of gem
  # @raise [Metasploit::Model::Configuration::Error] if {#root=} is not called prior to calling {#root}.
  def root
    unless instance_variable_defined?(:@root)
      raise Metasploit::Model::Configuration::Error, "#{self.class}.root not set prior to use"
    end

    @root
  end

  # Sets root of this gem.
  #
  # @param root [Pathname, String]
  # @return [String]
  def root=(root)
    @root = Pathname.new root
  end

  # Sets up {#autoload} and {#i18n}
  #
  # @return [void]
  # @raise [Metasploit::Model::Invalid] if {#configuration} {Metasploit::Model::Configuration#root} is not set.
  def setup
    autoload.setup
    i18n.setup
  end
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/configuration.rb
metasploit-model-0.26.1-java lib/metasploit/model/configuration.rb
metasploit-model-0.26.1 lib/metasploit/model/configuration.rb
metasploit-model-0.25.7 lib/metasploit/model/configuration.rb
metasploit-model-0.25.7-java lib/metasploit/model/configuration.rb
metasploit-model-0.25.6 lib/metasploit/model/configuration.rb
metasploit-model-0.25.6-java lib/metasploit/model/configuration.rb
metasploit-model-0.25.3 lib/metasploit/model/configuration.rb
metasploit-model-0.25.3-java lib/metasploit/model/configuration.rb
metasploit-model-0.25.2 lib/metasploit/model/configuration.rb
metasploit-model-0.25.2-java lib/metasploit/model/configuration.rb
metasploit-model-0.25.1 lib/metasploit/model/configuration.rb
metasploit-model-0.25.1-java lib/metasploit/model/configuration.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups-java lib/metasploit/model/configuration.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups lib/metasploit/model/configuration.rb
metasploit-model-0.24.1-java lib/metasploit/model/configuration.rb
metasploit-model-0.24.1 lib/metasploit/model/configuration.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 lib/metasploit/model/configuration.rb