Class: Metasploit::Model::Search::Operation::Group::Base

Inherits:
Base
  • Object
show all
Defined in:
app/models/metasploit/model/search/operation/group/base.rb

Overview

A group of one or more child operations from an operator's #operate_on, should be visited the same as Group::Base.

Direct Known Subclasses

Intersection, Union

Instance Attribute Summary collapse

Attributes inherited from Base

#operator, #value

Instance Method Summary collapse

Methods inherited from Base

#operator_valid

Methods inherited from Base

#initialize, #valid!

Constructor Details

This class inherits a constructor from Metasploit::Model::Base

Instance Attribute Details

#childrenObject

Methods



12
# File 'app/models/metasploit/model/search/operation/group/base.rb', line 12

attr_writer :children

Instance Method Details

#children_validvoid (private)

This method returns an undefined value.

Validates that #children are valid



49
50
51
52
53
54
55
56
57
58
# File 'app/models/metasploit/model/search/operation/group/base.rb', line 49

def children_valid
  if children.is_a? Enumerable
    # can't use children.all?(&:valid?) as it will short-circuit and want all children to have validation errors
    valids = children.map(&:valid?)

    unless valids.all?
      errors.add(:children, :invalid, value: children)
    end
  end
end