diff --git a/lib/dry/logic/predicates.rb b/lib/dry/logic/predicates.rb index 02dd1d8..e75907f 100644 --- a/lib/dry/logic/predicates.rb +++ b/lib/dry/logic/predicates.rb @@ -185,9 +185,16 @@ def uuid_v7?(input) = format?(UUIDv7, input) def uuid_v8?(input) = format?(UUIDv8, input) - def uri?(schemes, input) - uri_format = ::URI::RFC2396_PARSER.make_regexp(schemes) - format?(uri_format, input) + if defined?(::URI::RFC2396_PARSER) + def uri?(schemes, input) + uri_format = ::URI::RFC2396_PARSER.make_regexp(schemes) + format?(uri_format, input) + end + else + def uri?(schemes, input) + uri_format = ::URI::DEFAULT_PARSER.make_regexp(schemes) + format?(uri_format, input) + end end def uri_rfc3986?(input) = format?(::URI::RFC3986_Parser::RFC3986_URI, input)