dry-rb / dry-logic

Predicate logic with rule composition

Home Page:https://dry-rb.org/gems/dry-logic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uuid? predicate

zubin opened this issue · comments

UUIDs are widely used. Would you be open to adding a built-in predicate; something like this?

require 'uuidtools'

predicate(:uuid?) do |value|
  UUIDTools::UUID.parse(value).valid?
rescue ArgumentError, TypeError
  false
end

I'm happy to make a PR with tests if the idea is accepted.