class Katello::Apipie::Validators::IdentifierValidator
Public Class Methods
build(param_description, argument, _options, _block)
click to toggle source
# File lib/katello/apipie/validators.rb, line 22 def self.build(param_description, argument, _options, _block) if argument == :identifier self.new(param_description) end end
Public Instance Methods
description()
click to toggle source
# File lib/katello/apipie/validators.rb, line 32 def description "string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space.." end
error()
click to toggle source
# File lib/katello/apipie/validators.rb, line 28 def error "Parameter #{param_name} expecting to be an identifier, got: #{@error_value}" end
validate(value)
click to toggle source
# File lib/katello/apipie/validators.rb, line 17 def validate(value) value = value.to_s value =~ /\A[\w| |_|-]*\Z/ && value.strip == value && (2..128).include?(value.length) end