2015-10-06 13:50:26 +03:00
|
|
|
require_relative "base"
|
|
|
|
|
module Validators
|
|
|
|
|
module FieldValidator
|
|
|
|
|
class ImageName < Base
|
|
|
|
|
|
2016-01-27 15:44:59 +03:00
|
|
|
MAX_LEN = 100
|
2015-10-06 13:50:26 +03:00
|
|
|
|
|
|
|
|
def valid?
|
2016-01-27 15:44:59 +03:00
|
|
|
@value.length <= MAX_LEN
|
2015-10-06 13:50:26 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def message
|
2016-01-27 15:44:59 +03:00
|
|
|
"Invalid value '#{@value}': it should contains symbols 'a-zA-Z0-9_-.' and length should be more then 1 and less or equals then #{MAX_LEN}"
|
2015-10-06 13:50:26 +03:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|