Created
August 4, 2013 22:36
-
-
Save jpadams/6152236 to your computer and use it in GitHub Desktop.
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
| $tests = [ | |
| undef, # this is NOT a hash | |
| 'foobar', # this string is NOT a hash | |
| ### these are all the same as far as puppet is concerned | |
| #{a => b}, # | |
| #{"a" => "b"}, # | |
| {'a' => 'b'}, # | |
| ################ | |
| #{:a => :b}, this is not parseable | |
| "{:a => :b}",# this is NOT a hash | |
| {1 => 2}, # this IS a hash! | |
| "{3 => 4}" # this IS NOT a hash!! a string. | |
| ] | |
| hash_test { $tests: } | |
| define hash_test ($test = $title) { | |
| if is_hash($test) { | |
| notify{"yes, ${test} is a hash.\n":} | |
| } else { | |
| notify {"no, ${test} is NOT a hash.\n":} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment