-
-
Save anonymous/0782eff1fb232480adbff584230b0a17 to your computer and use it in GitHub Desktop.
yaml help
This file contains 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
Sample.yml: | |
accounts: | |
- domain: CONTOSO | |
username: Administrator | |
description: Some user | |
- domain: CONTSO | |
usernane: Joe | |
description: Some admin | |
Sample.rb: | |
#!/usr/bin/env ruby | |
require 'yaml' | |
config = YAML.load_file("Sample.yaml") | |
accounts = config["accounts"] | |
test = {"domain"=>"CONTOSO", "username"=>"Administrator", "description"=>"Some user"} | |
puts(accounts.include? test) | |
<<exports true> | |
Is there a less sloppy way of testing for this without having to type the keyvalues in such an ugly way? | |
I need some crafty way of checking if a specific user exists in this sample list without overly complicating a search? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment