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.
18 19 20 21 22 23 24 25 26 |
# File 'lib/metasploit/model/search/with.rb', line 18 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.
33 34 35 |
# File 'lib/metasploit/model/search/with.rb', line 33 def search_with_operator_by_name @search_with_operator_by_name ||= {} end |