class Attribool::Validators::AttributeListValidator
Ensures that every item is an instance of Attribool::Attribute
.
Public Class Methods
new(*items)
click to toggle source
Construct the validator.
@param [Attribool::Attribute] *items
# File lib/attribool/validators/attribute_list_validator.rb, line 11 def initialize(*items) @items = items end
Public Instance Methods
error()
click to toggle source
The exception to raise if validations fail.
@return [TypeError] the exception with message
# File lib/attribool/validators/attribute_list_validator.rb, line 27 def error TypeError.new("All items must be an instance of Attribool::Attribute") end
valid?()
click to toggle source
Are all items an instance of Attribool::Attribute
?
@return [Boolean]
# File lib/attribool/validators/attribute_list_validator.rb, line 19 def valid? @items.all?(Attribool::Attribute) end