Hello, I recently released command_kit, which is a zero-dependency all-in-one kitchen-sink-included kit for building CLI apps. I borrowed some of the functions from dry-inflector since I only needed a very basic inflector for converting file names / command names to Class names. My next goal was to port command_kit to Crystal. However, Crystal does not support
Regexp.last_match (which it shouldn’t, because global state), so I refactored the inflector methods to use
StringScanner; which improved the performance of
underscore but slowed down
camelize. Eventually I want to submit a PR back to dry-inflector, however my algorithm deviates slightly from dry-inflector’s original algorithm:
-s to a single
This raised the question about what should the ideal behavior be? Should
- be preserved, reduced, or entirely omitted when converting a CamelCase string to under_scored or vice versa?