Class: Inspector::Constraint::Validators::Simple

Inherits:
Object
  • Object
show all
Defined in:
lib/inspector/constraint/validators/simple.rb

Instance Method Summary collapse

Instance Method Details

#validate(value, constraint, violations_list) ⇒ Object



5
6
7
8
9
# File 'lib/inspector/constraint/validators/simple.rb', line 5

def validate(value, constraint, violations_list)
  if constraint.positive? ^ constraint.valid?(value)
    violations_list << Constraint::Violation.new(constraint)
  end
end