class Hermod::Validators::RegularExpression
Checks the value matches the given regular expression
def initialize(pattern)
def initialize(pattern) @pattern = pattern end
def message(value, attributes)
def message(value, attributes) "#{value.inspect} does not match #{pattern.inspect}" end
def test(value, attributes)
because those are checked by the ValuePresence validator if necessary.
Public: Checks the value matches the pattern. Blank values are ignored
def test(value, attributes) value.blank? || value =~ pattern end