Sha256: 964c97b15843bce997cfc161a81365da044a63aa93396b8642a2dfdb131ecaf9

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'metasploit/model/base'
require 'metasploit/model/search/operation'

# Base of all search operations that combine an {#operator} with the {#value} it is operating on.  Subclasses allow
# validations specific to the {#operator} {Metasploit::Model::Search::Operator::Single#type type}.
class Metasploit::Model::Search::Operation::Base < Metasploit::Model::Base
  #
  # Attributes
  #

  # @!attribute [rw] operator
  #   The operator operating on {#value}.
  #
  #   @return [Metasploit::Model::Search::Operator::Base]
  attr_accessor :operator

  # @!attribute [rw] value
  #   The value cast to the correct type from the formatted_value from the formatted operation.
  #
  #   @return [String]
  attr_accessor :value

  #
  # Validations
  #

  validates :operator,
            :presence => true
  # validate_associated is defined by ActiveRecord, so have to do it manually here.
  validate :operator_valid

  private

  # Validates that {#operator} is valid
  #
  # @return [void]
  def operator_valid
    if operator and !operator.valid?
      errors.add(:operator, :invalid, :value => operator)
    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/base.rb
metasploit-model-0.27.3-java app/models/metasploit/model/search/operation/base.rb
metasploit-model-0.27.2 app/models/metasploit/model/search/operation/base.rb
metasploit-model-0.27.2-java app/models/metasploit/model/search/operation/base.rb
metasploit-model-0.27.1 app/models/metasploit/model/search/operation/base.rb
metasploit-model-0.27.1-java app/models/metasploit/model/search/operation/base.rb
metasploit-model-0.27.0 app/models/metasploit/model/search/operation/base.rb
metasploit-model-0.27.0-java app/models/metasploit/model/search/operation/base.rb