Module: Metasploit::Model::Search::ClassMethods

Defined in:
lib/metasploit/model/search.rb

Overview

Allows operators registered with Association::ClassMethods#search_association and Attribute::ClassMethods#search_attribute to be looked up by name.

Instance Method Summary collapse

Instance Method Details

#search_operator_by_nameHash{Symbol => Metasploit::Model::Search::Operator}

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


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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