class Metasploit::Model::Search::Operation::Set
Operation on an attribute that has a constrained Set of valid {Metasploit::Model::Search::Operation::Base#value values}.
Private Instance Methods
membership()
click to toggle source
Validates that {#value} is a member of {Metasploit::Model::Search::Operation::Base#operator} {Metasploit::Model::Search::Operator::Attribute#attribute_set}.
@return [void]
# File app/models/metasploit/model/search/operation/set.rb, line 21 def membership if operator attribute_set = operator.attribute_set unless attribute_set.include? value # sort (because Sets are unordered) before inspecting so that lexigraphical sorting is NOT used sorted = attribute_set.sort # use inspect to differentiate between strings and integers or string and symbols inspected = sorted.map(&:inspect) # format as a human readable Set using { } comma_separated = inspected.join(', ') human_set = "{#{comma_separated}}" errors.add(:value, :inclusion, set: human_set) end end end