crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.26k stars 1.61k forks source link

Fix `Regex#inspect` with non-literal-compatible options #14575

Closed straight-shoota closed 2 months ago

straight-shoota commented 2 months ago

With this patch Regex#inspect only uses the literal syntax when all option flags can be represented. If options includes additional flags, it uses a more extensive representation based on the constructor form.

I'm not sure if the helper methods #inspect_literal and #inspect_extensive should really be exposed. I can't see any specific use case for calling them directly instead of #inspect. We could make them private and move all documentation to #inspect.

Resolves #14530