Module: Usher::Route::Variable::ProcValidator

Includes:
Validator
Defined in:
lib/usher/route/variable.rb

Instance Method Summary collapse

Methods included from Validator

#validates?

Instance Method Details

#valid!(val) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/usher/route/variable.rb', line 13

def valid!(val)
  begin
    @validator.call(val) or raise(ValidationException.new("#{val} does not conform to #{@validator}"))
  rescue Exception => e
    raise ValidationException.new("#{val} does not conform to #{@validator}, root cause #{e.inspect}")
  end
end