Sha256: 6c594f9c3b246000cce1686775a6bd87acdcb5894d60f7063d6eb0749f976b27

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

require 'metasploit/model/search/operator'

# A search operator declared with
# {Metasploit::Model::Search::Attribute::ClassMethods#search_attribute search_attribute}.
class Metasploit::Model::Search::Operator::Attribute < Metasploit::Model::Search::Operator::Single
  #
  # CONSTANTS
  #

  # The valid {#type types}.
  TYPES = [
      :boolean,
      :date,
      :integer,
      {
          set: :integer
      },
      {
          set: :string
      },
      :string
  ]

  #
  # Attributes
  #

  # @!attribute [r] attribute
  #   The attribute on {Metasploit::Model::Search::Operator::Base#klass klass} that is searchable.
  #
  #   @return [Symbol] the attribute name
  attr_accessor :attribute

  # @!attribute [r] type
  #   The type of {#attribute}.
  #
  #   @return [Symbol] Value from {TYPES}.
  attr_accessor :type

  #
  # Validations
  #

  validates :attribute, :presence => true
  validates :type,
            :inclusion => {
                :in => TYPES
            }

  #
  # Methods
  #

  # Set for {#attribute} as provided by {Metasploit::Model::Search::Operator::Base#klass #klass}.
  #
  # @return [Enumerable, #include?]
  def attribute_set
    klass.send("#{attribute}_set")
  end

  alias_method :name, :attribute
end

Version data entries

8 entries across 8 versions & 1 rubygems

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