Sha256: 827aad271807208848e13c62b15b7508a5e7225dd4e18afc7bdcca1f92d3488e

Contents?: true

Size: 1.46 KB

Versions: 45

Compression:

Stored size: 1.46 KB

Contents

# An operation with a {Metasploit::Model::Search::Operator::Association} for
# {Metasploit::Model::Search::Operation::Base#operator} that wraps a {#source_operation} produced by the
# {Metasploit::Model::Search::Operator::Association#source_operator}.  This allows an arbitrary number of associations
# to be changed together until a non-association operation is found that actually validates the value.
class Metasploit::Model::Search::Operation::Association < Metasploit::Model::Search::Operation::Base
  #
  # Attributes
  #

  # @!attribute source_operation
  #   The operation from the {Metasploit::Model::Search::Operator::Association#source_operator}.
  #
  #   @return [Metasploit::Model::Search::Operation::Base]
  attr_accessor :source_operation

  #
  #
  # Validations
  #
  #

  #
  # Validation Methods
  #

  validate :source_operation_valid

  #
  # Attribute Validations
  #

  validates :source_operation,
            presence: true

  #
  # Instance Methods
  #

  # Explicitly remove value attribute so code that depends on the old behavior will break so downstream developers know
  # to update their code to use source_operation.
  undef_method :value
  undef_method :value=

  private

  # Validates that {#source_operation} is valid.
  #
  # @return [void]
  def source_operation_valid
    # presence validation handles errors when nil
    if source_operation
      unless source_operation.valid?
        errors.add(:source_operation, :invalid)
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 app/models/metasploit/model/search/operation/association.rb
metasploit-model-5.0.1 app/models/metasploit/model/search/operation/association.rb
metasploit-model-5.0.0 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.6 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.5 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.4 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.3 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.2 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.1 app/models/metasploit/model/search/operation/association.rb
metasploit-model-4.0.0 app/models/metasploit/model/search/operation/association.rb
metasploit-model-3.1.4 app/models/metasploit/model/search/operation/association.rb
metasploit-model-3.1.3 app/models/metasploit/model/search/operation/association.rb
metasploit-model-3.1.2 app/models/metasploit/model/search/operation/association.rb
metasploit-model-3.1.1 app/models/metasploit/model/search/operation/association.rb
metasploit-model-3.1.0 app/models/metasploit/model/search/operation/association.rb
metasploit-model-3.0.0 app/models/metasploit/model/search/operation/association.rb
metasploit-model-2.0.4 app/models/metasploit/model/search/operation/association.rb
metasploit-model-2.0.3 app/models/metasploit/model/search/operation/association.rb
metasploit-model-2.0.2 app/models/metasploit/model/search/operation/association.rb
metasploit-model-2.0.1 app/models/metasploit/model/search/operation/association.rb