Class: Booth::Syntaxes::Uuid
- Inherits:
-
Object
- Object
- Booth::Syntaxes::Uuid
- Includes:
- Logging, MethodObject
- Defined in:
- lib/booth/syntaxes/uuid.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#regexp ⇒ Object
For practical reasons we only accept downcased (i.e. normalized) UUIDs.
Methods included from MethodObject
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 |
# File 'lib/booth/syntaxes/uuid.rb', line 10 def call return Tron.success(:valid_uuid, uuid: input) if regexp.match(input.to_s) raise ArgumentError, "Invalid UUID: #{input.inspect}" if raise_if_invalid Tron.failure :invalid_uuid, uuid: nil end |
#regexp ⇒ Object
For practical reasons we only accept downcased (i.e. normalized) UUIDs.
18 19 20 |
# File 'lib/booth/syntaxes/uuid.rb', line 18 def regexp /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/ end |