Class: FormKeeper::Constraint::ByteSize
Instance Method Summary collapse
Instance Method Details
#validate(value, arg) ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/formkeeper.rb', line 298 def validate(value, arg) l = value.bytesize case arg when Fixnum return (l == arg) when Range return arg.include?(l) else raise ArgumentError, 'Invalid number of arguments' end end |