Sha256: 9cca04ee939712303a541082edd55c6bfad12b02af23a709a4940ddc68d6a424
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
require 'metasploit/model/search/operation/group' # A group of one or more {#children child operations} from an operator's `#operate_on`, should be visited the same as # {Metasploit::Model::Search::Group::Base}. class Metasploit::Model::Search::Operation::Group::Base < Metasploit::Model::Search::Operation::Base # # Attributes # # @!attribute [rw] children # Children operations of union. # # @return [Array<Metasploit::Model::Search::Operation::Base>] attr_writer :children # # # Validations # # # # Method Validations # # validate_associated is defined by ActiveRecord, so have to do it manually here. validate :children_valid # # Attribute Validations # validates :children, :length => { :minimum => 1 } # # Methods # def children @children ||= [] end private # Validates that {#children} are valid # # @return [void] 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 end
Version data entries
8 entries across 8 versions & 1 rubygems