Class: FormKeeper::Constraint::Regexp

Inherits:
Base
  • Object
show all
Defined in:
lib/formkeeper.rb

Instance Method Summary collapse

Instance Method Details

#validate(value, arg) ⇒ Object



117
118
119
120
121
# File 'lib/formkeeper.rb', line 117

def validate(value, arg)
  r = arg
  r = ::Regexp.new(r) unless r.kind_of?(::Regexp)
  !!(value =~ r)
end