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.
110 111 112 |
# File 'lib/metasploit/model/search/association.rb', line 110 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.
159 160 161 162 163 164 |
# File 'lib/metasploit/model/search/association.rb', line 159 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.
169 170 171 |
# File 'lib/metasploit/model/search/association.rb', line 169 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.
146 147 148 149 150 151 152 153 |
# File 'lib/metasploit/model/search/association.rb', line 146 def search_associations(*associations) = Metasploit::Model::Association::Tree.(associations) @search_association_tree = Metasploit::Model::Association::Tree.merge( search_association_tree, ) end |