class Hermod::Validators::RegularExpression

Checks the value matches the given regular expression

def initialize(pattern)

Sets up the pattern the value is expected to match
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)

Returns a boolean

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