Class: FormKeeper::Constraint::Length
Instance Method Summary collapse
Instance Method Details
#validate(value, arg) ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/formkeeper.rb', line 284 def validate(value, arg) l = value.length case arg when Fixnum return (l == arg) when Range return arg.include?(l) else raise ArgumentError, 'Invalid number of arguments' end end |