class Hermod::Validators::Attributes
Checks the attributes are in a list of allowed attributes
def bad_attributes(attributes)
def bad_attributes(attributes) attributes.map do |attribute, _| attribute unless allowed_attributes.include? attribute end.compact end
def initialize(allowed_attributes)
def initialize(allowed_attributes) @allowed_attributes = allowed_attributes end
def message(value, attributes)
def message(value, attributes) "has attributes it doesn't accept: #{bad_attributes(attributes).to_sentence}" end
def test(value, attributes)
def test(value, attributes) bad_attributes(attributes) == [] end