class Validation::Rule::Guid

GUID validation rule

Valid is a String that is at least 16 and at most 255 chars long. It contains only:

Special chars aren’t allowed at the end.

Constants

VALID_CHARS

Allowed chars to validate a GUID with a regex

Public Instance Methods

error_key() click to toggle source

The error key for this rule @return [Symbol] error key

# File lib/diaspora_federation/validators/rules/guid.rb, line 18
def error_key
  :guid
end
params() click to toggle source

This rule has no params. @return [Hash] params

# File lib/diaspora_federation/validators/rules/guid.rb, line 29
def params
  {}
end
valid_value?(value) click to toggle source

Determines if value is a valid GUID

# File lib/diaspora_federation/validators/rules/guid.rb, line 23
def valid_value?(value)
  value.is_a?(String) && value =~ /\A#{VALID_CHARS}\z/
end