This packs the logic of reading a file and doing a regular expression match into one place, and returns the regex capture as a side effect. It would be a bit more clear to explicitly check and return values like https://github.com/CumulusNetworks/facter/blob/6628b079b6aa7551e59dbd7c2451640cf21f37f6/lib/facter/operatingsystemrelease.rb#L69