Skip to content

Instantly share code, notes, and snippets.

/yaml_parse.rb Secret

Created November 24, 2015 10:36
Show Gist options
  • Save anonymous/97b826594f40ae228f2a to your computer and use it in GitHub Desktop.
Save anonymous/97b826594f40ae228f2a to your computer and use it in GitHub Desktop.
parsing yaml
gregf@jupiter:/var/www/dev_hermes_backend/current$ cat foo.yml
foo: 1
bar:
- 100
- 200
baz: hello
useragent: Mozilla
gregf@jupiter:/var/www/dev_hermes_backend/current$ ruby -le '
require "yaml"; data = YAML.load_file("./foo.yml"); p data.select { |k,v| k =~ /useragent/ }
'
{"useragent"=>"Mozilla"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment