Class: Metasploit::Model::Search::Operator::Base
- Includes:
- ActiveModel::Validations, Help
- Defined in:
- app/models/metasploit/model/search/operator/base.rb
Overview
Instead of writing an operator completely from scratch, you can subclass 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
Direct Known Subclasses
Instance Attribute Summary collapse
-
#klass ⇒ Class
The class on which this operator is usable.
Instance Method Summary collapse
-
#name ⇒ String
abstract
Name of this operator.
Methods included from Help
Methods inherited from Base
Constructor Details
This class inherits a constructor from Metasploit::Model::Base
Instance Attribute Details
#klass ⇒ Class
The class on which this operator is usable.
33 34 35 |
# File 'app/models/metasploit/model/search/operator/base.rb', line 33 def klass @klass end |
Instance Method Details
#name ⇒ String
This method is abstract.
subclass and derive operator name from attributes of subclass.
Name of this operator.
47 48 49 |
# File 'app/models/metasploit/model/search/operator/base.rb', line 47 def name raise NotImplementedError end |