lib/usher/route/variable.rb in usher-0.7.2 vs lib/usher/route/variable.rb in usher-0.7.3

- old
+ new

@@ -1,20 +1,28 @@ class Usher class Route class Variable + module Validator + def validates? + true + end + end + module ProcValidator + include Validator def valid!(val) begin @validator.call(val) rescue Exception => e raise ValidationException.new("#{val} does not conform to #{@validator}, root cause #{e.inspect}") end end end module CaseEqualsValidator + include Validator def valid!(val) @validator === val.to_s or raise(ValidationException.new("#{val} does not conform to #{@validator}")) end end @@ -36,9 +44,13 @@ end end private :initialize def valid!(val) + end + + def validates? + false end def ==(o) o && (o.class == self.class && o.name == @name && o.validator == @validator) end \ No newline at end of file