Module: Metasploit::Model::Search::Association::ClassMethods
- Defined in:
- lib/metasploit/model/search/association.rb
Overview
Adds #search_association DSL to make association search operators.
Instance Method Summary collapse
-
#search_association(association) ⇒ void
Registers association for search.
-
#search_association_operators ⇒ Array<Metasploit::Model::Search::Operator::Association>
The association operators for the searchable associations declared with #search_association and #search_associations.
-
#search_association_tree ⇒ Hash{Symbol => Hash,nil}
Tree of associations that are searchable.
-
#search_associations(*associations) ⇒ void
Registers a tree of near and far associations for search.
Instance Method Details
#search_association(association) ⇒ void
Use #search_associations to declare multiple associations or a tree of far associations as searchable.
This method returns an undefined value.
Registers association for search.
107 108 109 |
# File 'lib/metasploit/model/search/association.rb', line 107 def search_association(association) search_association_tree[association.to_sym] ||= nil end |
#search_association_operators ⇒ Array<Metasploit::Model::Search::Operator::Association>
The association operators for the searchable associations declared with #search_association and #search_associations.
156 157 158 159 160 161 |
# File 'lib/metasploit/model/search/association.rb', line 156 def search_association_operators @search_association_operators ||= Metasploit::Model::Association::Tree.operators( search_association_tree, class: self ) end |
#search_association_tree ⇒ Hash{Symbol => Hash,nil}
Tree of associations that are searchable.
166 167 168 |
# File 'lib/metasploit/model/search/association.rb', line 166 def search_association_tree @search_association_tree ||= {} end |
#search_associations(*associations) ⇒ void
This method returns an undefined value.
Registers a tree of near and far associations for search. When a tree is used, all intermediate association
on the paths are used, so search_association children: :grandchildren
makes both children.granchildren
and children
as search operator prefixes.
143 144 145 146 147 148 149 150 |
# File 'lib/metasploit/model/search/association.rb', line 143 def search_associations(*associations) = Metasploit::Model::Association::Tree.(associations) @search_association_tree = Metasploit::Model::Association::Tree.merge( search_association_tree, ) end |