fluke/devops-service/db/validators/field_validators/image_name.rb
Tim Lianov 0fe1218731 Revert "Merge branch 'qa' into release"
This reverts commit 49ba7a8b0d, reversing
changes made to eb753df4c9.
2016-01-21 12:10:36 -05:00

19 lines
438 B
Ruby

require_relative "base"
module Validators
module FieldValidator
class ImageName < Base
MAX_NAME_LEN = 100
NAME_REGEX = /\A[\w\-\.]{1,#{MAX_NAME_LEN}}\z/
def valid?
!NAME_REGEX.match(@value).nil?
end
def message
"Invalid value '#{@value}': it should contains symbols 'a-zA-Z0-9_-.' and length should be more then 1 and less or equals then #{MAX_NAME_LEN}"
end
end
end
end