Sha256: 4824c3ddf0ae42ff53275fde8ae99831f707aa0476413de913dbfd34223e5a0b

Contents?: true

Size: 1.5 KB

Versions: 8

Compression:

Stored size: 1.5 KB

Contents

require 'metasploit/model/search/operation'

# 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

8 entries across 8 versions & 1 rubygems

Version Path
metasploit-model-0.27.3 app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.3-java app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.2 app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.2-java app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.1 app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.1-java app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.0 app/models/metasploit/model/search/operation/association.rb
metasploit-model-0.27.0-java app/models/metasploit/model/search/operation/association.rb