psych
psych copied to clipboard
Toplevel [] method for YAML?
Would it be possible to alias YAML[] onto YAML.load_file()?
E. g.:
x = YAML.load_file('foobar.yml')
x = YAML['foobar.yml']
Rationale:
Laziness (or "user efficiency" - anything to type less, just as require 'pp' is no longer necessary. :D
Is there any precedent for such an alias? Are there other libraries that alias one of their methods to a module-level []? I have to admit it looks a little weird to my eyes.
There's another Ruby quirk that could be used instead: YAML.(), which Ruby treats as a call to YAML.call. The more you know! 🌠