StringScanner
Currently reading Rebuilding Rails by Noah Gibbs.
At some point, he writes about checking out Active Support for some pointers on metaprogramming. Currently felt into a rabbit hole on the duration part of the lib.
Anyways. Here’s a nifty class in Ruby that facilitates some scanning on strings.
StringScanner provides for lexical scanning operations on a String. source