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-2.0.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-1.1.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-1.0.2 app/models/metasploit/model/search/operator/base.rb
metasploit-model-1.0.1 app/models/metasploit/model/search/operator/base.rb
metasploit-model-1.0.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.2 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.2-java app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.1 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.1-java app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.1.pre.rspec.pre.3.pre.1 app/models/metasploit/model/search/operator/base.rb
metasploit-model-1.0.0.pre.rails.pre.4.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.30.0-java app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.29.2 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.29.2-java app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.29.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.29.0-java app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.28.0 app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.28.0-java app/models/metasploit/model/search/operator/base.rb
metasploit-model-0.28.0.pre.engine.pre.requires app/models/metasploit/model/search/operator/base.rb