Sha256: 38f0674feef76671a6580d8f218144f29512d34119de97187ab20d063005c677

Contents?: true

Size: 1.24 KB

Versions: 45

Compression:

Stored size: 1.24 KB

Contents

# Instead of writing an operator completely from scratch, you can subclass
# {Metasploit::Model::Search::Operator::Base}.
#
#     class MyOperator < Metasploit::Model::Search::Operator::Base
#       # Name of this operator.  The name of the operator is matched to the string before the ':' in a formatted
#       # operation.
#       #
#       # @return [Symbol]
#       def name
#         # ...
#       end
#
#       # Creates a one or more operations based on `formatted_value`.
#       #
#       # @return [#operator, Array<#operator>] Operation with this operator as the operation's `operator`.
#       def operate_on(formatted_value)
#         # ...
#       end
#     end
#
class Metasploit::Model::Search::Operator::Base < Metasploit::Model::Base
  include ActiveModel::Validations
  include Metasploit::Model::Search::Operator::Help

  #
  # Attributes
  #

  # @!attribute [rw] klass
  #   The class on which this operator is usable.
  #
  #   @return [Class]
  attr_accessor :klass

  #
  # Validations
  #

  validates :klass, :presence => true

  # @abstract subclass and derive operator name from attributes of subclass.
  #
  # Name of this operator.
  #
  # @return [String]
  # @raise [NotImplementedError]
  def name
    raise NotImplementedError
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

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