module Metasploit::Model::Search::ClassMethods

Allows operators registered with {Metasploit::Model::Search::Association::ClassMethods#search_association} and {Metasploit::Model::Search::Attribute::ClassMethods#search_attribute} to be looked up by name.

Public Instance Methods

search_operator_by_name() click to toggle source

Collects all search attributes from search associations and all attributes from this class to show the valid search operators to search.

@return [Hash{Symbol => Metasploit::Model::Search::Operator}] Maps

{Metasploit::Model::Search::Operator::Base#name} to {Metasploit::Model::Search::Operator::Base#name}.
# File lib/metasploit/model/search.rb, line 87
def search_operator_by_name
  unless instance_variable_defined? :@search_operator_by_name
    @search_operator_by_name = {}

    search_with_operator_by_name.each_value do |operator|
      @search_operator_by_name[operator.name] = operator
    end

    search_association_operators.each do |operator|
      @search_operator_by_name[operator.name] = operator
    end
  end

  @search_operator_by_name
end