Class: Metasploit::Model::Search::Operator::Group::Base
- Inherits:
-
Delegation
- Object
- 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
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>
Metasploit::Model::Search::Operation::Group::Base#children.
-
#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.
Class Method Details
.operation_class ⇒ Class<Metasploit::Model::Search::Operation::Group::Base>
Group operation class to wrap #children in and return from #operate_on.
27 28 29 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 27 def self.operation_class @operation_class ||= operation_class_name.constantize end |
.operation_class_name ⇒ String
The name of the operation_class.
17 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 17 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'.
35 36 37 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 35 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.
17 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 17 class_attribute :operation_class_name |
Instance Method Details
#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Base>
Metasploit::Model::Search::Operation::Group::Base#children.
49 50 51 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 49 def children(formatted_value) raise NotImplementedError end |
#operate_on(formatted_value) ⇒ Metasploit::Model::Search::Operation::Group::Base
Group's children operating on formatted_value.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 63 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.
54 55 56 |
# File 'app/models/metasploit/model/search/operator/group/base.rb', line 54 def operation_class self.class.operation_class end |