Class: FormKeeper::Constraint::URI

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

Instance Method Summary collapse

Instance Method Details

#validate(value, arg) ⇒ Object



241
242
243
244
245
246
# File 'lib/formkeeper.rb', line 241

def validate(value, arg)
  u = ::URI.parse(value)
  return false if u.nil?
  arg = [arg] unless arg.kind_of?(Array)
  arg.collect(&:to_s).include?(u.scheme)
end