Class: Metasploit::Model::Search::Operator::Group::Base
- Inherits:
-
Delegation
- Object
- Base
- Base
- Delegation
- Metasploit::Model::Search::Operator::Group::Base
- Defined in:
- app/models/metasploit/model/search/operator/group/base.rb
Overview
Operator that produces group operations.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.operation_class ⇒ Class<Metasploit::Model::Search::Operation::Group::Base>
Group operation class to wrap #children in and return from #operate_on.
-
.operation_class_name ⇒ String
The name of the Base.operation_class.
-
.operation_class_name! ⇒ void
Sets the Base.operation_class_name to the operation with same name as this operator, but with 'Operation' substituted for 'Operator'.
-
.operation_class_name=(operation_class_name) ⇒ void
Set the name of the Base.operation_class.
Instance Method Summary collapse
- #children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Base>
-
#operate_on(formatted_value) ⇒ Metasploit::Model::Search::Operation::Group::Base
Group's children operating on
formatted_value
. -
#operation_class ⇒ Class<Metasploit::Model::Search::Operation::Group::Base>
Group operation class to wrap #children in and return from #operate_on.
Methods inherited from Delegation
#name, #operator, operator_name
Methods inherited from Base
Methods included from Help
Methods inherited from Base
Constructor Details
This class inherits a constructor from Metasploit::Model::Base
Class Method Details
.operation_class ⇒ Class<Metasploit::Model::Search::Operation::Group::Base>
Group operation class to wrap #children in and return from #operate_on.
29 30 31 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 29 def self.operation_class @operation_class ||= operation_class_name.constantize end |
.operation_class_name ⇒ String
The name of the operation_class.
19 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 19 class_attribute :operation_class_name |
.operation_class_name! ⇒ void
This method returns an undefined value.
Sets the operation_class_name to the operation with same name as this operator, but with 'Operation' substituted for 'Operator'.
37 38 39 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 37 def self.operation_class_name! self.operation_class_name = name.gsub('Operator', 'Operation') end |
.operation_class_name=(operation_class_name) ⇒ void
This method returns an undefined value.
Set the name of the operation_class.
19 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 19 class_attribute :operation_class_name |
Instance Method Details
#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Base>
51 52 53 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 51 def children(formatted_value) raise NotImplementedError end |
#operate_on(formatted_value) ⇒ Metasploit::Model::Search::Operation::Group::Base
Group's children operating on formatted_value
.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 65 def operate_on(formatted_value) children = self.children(formatted_value) # filter children for validity as valid values for one child won't necessarily be valid values for another child. # this is specifically a problem with Metasploit::Model::Search::Operation::Set as no partial matching is allowed, # but can also be a problem with string vs integer operations. valid_children = children.select(&:valid?) operation_class.new( :children => valid_children, :operator => self, :value => formatted_value ) end |
#operation_class ⇒ Class<Metasploit::Model::Search::Operation::Group::Base>
Group operation class to wrap #children in and return from #operate_on.
56 57 58 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 56 def operation_class self.class.operation_class end |