class Validation::Rule::DiasporaId
diaspora* ID validation rule
A simple rule to validate the base structure of diaspora* IDs.
Constants
- DIASPORA_ID
The Regex for validating a full diaspora* ID
- DIASPORA_ID_MAX_LENGTH
Maximum length of a full diaspora* ID
- DIASPORA_ID_REGEX
The Regex for a valid diaspora* ID
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/diaspora_id.rb, line 31 def error_key :diaspora_id end
params()
click to toggle source
This rule has no params. @return [Hash] params
# File lib/diaspora_federation/validators/rules/diaspora_id.rb, line 45 def params {} end
valid_value?(value)
click to toggle source
Determines if value is a valid diaspora* ID
# File lib/diaspora_federation/validators/rules/diaspora_id.rb, line 36 def valid_value?(value) return false unless value.is_a?(String) return false if value.length > DIASPORA_ID_MAX_LENGTH value =~ DIASPORA_ID end