Pretty Printing YAML with the Ruby Command-Line

Today I had a pretty fun little thing to do - validate that a YAML file was well formed (because it turns out, it wasn't).
I wanted a handy one-liner to confirm it, similar to my Pretty Print JSON series.
As I use Ruby for my primarily scripting language of choice, this example will be done with Ruby.
To parse the YAML file, and then pretty-print it, we can simply run:
ruby -ryaml -e 'puts YAML.load(ARGF.read).to_yaml' file.yaml
ruby -ryaml -e 'puts YAML.load(ARGF.read).to_yaml' < file.yaml
And because YAML is a valid superset of JSON, we can also use the same for JSON files!
ruby -ryaml -e 'puts YAML.load(ARGF.read).to_yaml' file.json
ruby -ryaml -e 'puts YAML.load(ARGF.read).to_yaml' < file.json