Module: Metasploit::Model::Search::Operation
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/metasploit/model/search/operation.rb
Overview
Namespace for search operations. Operation.parse acts as a factory to parse a String
and return a type-specific
operation.
Defined Under Namespace
Modules: Group, Value Classes: Association, Base, Boolean, Date, Integer, Jsonb, Null, Set, String
Class Method Summary collapse
-
.parse(options = {}) ⇒ Metasploit::Model::Search::Operation::Base+
Operation(s) parsed from the formatted operation.
Class Method Details
.parse(options = {}) ⇒ Metasploit::Model::Search::Operation::Base+
Returns operation(s) parsed from the formatted operation.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/metasploit/model/search/operation.rb', line 25 def self.parse(={}) formatted_operation = .fetch(:formatted_operation) query = .fetch(:query) formatted_operator, formatted_value = formatted_operation.split(':', 2) operator = query.parse_operator(formatted_operator) # formatted_value will be nil if formatted_operation did not contain a ':', it should be treated the same # as nothing after the ':'. formatted_value ||= '' operation_or_operations = operator.operate_on(formatted_value) operation_or_operations end |