Class: Stannum::Constraints::Uuid
- Defined in:
- lib/stannum/constraints/uuid.rb
Overview
A UUID constraint asserts the value is a string in UUID format.
Constant Summary collapse
- NEGATED_TYPE =
The :type of the error generated for a matching object.
'stannum.constraints.is_a_uuid'- TYPE =
The :type of the error generated for a non-matching object.
'stannum.constraints.is_not_a_uuid'- UUID_FORMAT =
Regular expression describing a valid upper- or lower-case UUID.
/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/
Instance Attribute Summary
Attributes inherited from Format
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(**options) ⇒ Uuid
constructor
A new instance of Uuid.
Methods inherited from Format
Methods inherited from Base
#==, #clone, #does_not_match?, #dup, #errors_for, #match, #matches?, #message, #negated_errors_for, #negated_match, #negated_message, #negated_type, #type, #with_options
Constructor Details
#initialize(**options) ⇒ Uuid
Returns a new instance of Uuid.
26 27 28 |
# File 'lib/stannum/constraints/uuid.rb', line 26 def initialize(**) super(UUID_FORMAT, **) end |