Last active
August 29, 2015 14:02
-
-
Save katmutua/7e1e249808684f5e2e87 to your computer and use it in GitHub Desktop.
Query YAML File for an object's value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'yaml' | |
| username = 'some_user' | |
| users = YAML.load_file('users.yaml') | |
| user = users.find { |user| user.username = username} | |
| puts user.username |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment