Module: Metasploit::Model::Search::With::ClassMethods
- Defined in:
- lib/metasploit/model/search/with.rb
Overview
Defines search_with
DSL, which is a lower-level way than search_attribute to add operators. search_with
allows instance of arbitrary operator_classes to be registered in #search_with_operator_by_name.
Instance Method Summary collapse
-
#search_with(operator_class, options = {}) ⇒ Metasploit::Model::Search::Operator::Base
Declares that this class should be search with an instance of the given
operator_class
. -
#search_with_operator_by_name ⇒ Hash{Symbol => Metasploit::Model::Search::Operator::Base}
Operators registered with #search_with.
Instance Method Details
#search_with(operator_class, options = {}) ⇒ Metasploit::Model::Search::Operator::Base
Declares that this class should be search with an instance of the given operator_class
.
61 62 63 64 65 66 67 68 69 |
# File 'lib/metasploit/model/search/with.rb', line 61 def search_with(operator_class, ={}) merged_operations = .merge( :klass => self ) operator = operator_class.new(merged_operations) operator.valid! search_with_operator_by_name[operator.name] = operator end |
#search_with_operator_by_name ⇒ Hash{Symbol => Metasploit::Model::Search::Operator::Base}
Operators registered with #search_with.
76 77 78 |
# File 'lib/metasploit/model/search/with.rb', line 76 def search_with_operator_by_name @search_with_operator_by_name ||= {} end |