diff options
author | Bryan Jen <bryan.jen@gmail.com> | 2016-05-12 14:14:14 -0700 |
---|---|---|
committer | Bryan Jen <bryan.jen@gmail.com> | 2016-05-12 14:14:14 -0700 |
commit | ecfdbb2690359434f1737d05ce723cf2f5d05c4e (patch) | |
tree | 7c90052d6cd3bb4d4f15a4b347ba6017360f3a42 /README.markdown | |
parent | 7a008a70b6faa8e06df966677376cb84a80c25e5 (diff) | |
parent | 870a272cee6889934d60c4bfd7a814bcf47011f1 (diff) |
Merge pull request #600 from dmitryilyin/master
Add the default value to the "loadyaml" function
Diffstat (limited to 'README.markdown')
-rw-r--r-- | README.markdown | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown index e4efa9e..6a64b79 100644 --- a/README.markdown +++ b/README.markdown @@ -661,12 +661,42 @@ Returns the keys of a hash as an array. *Type*: rvalue. #### `loadyaml` -Loads a YAML file containing an array, string, or hash, and returns the data in the corresponding native data type. For example: +Loads a YAML file containing an array, string, or hash, and returns the data in the corresponding native data type. + +For example: ~~~ $myhash = loadyaml('/etc/puppet/data/myhash.yaml') ~~~ +The second parameter will be returned if the file was not found or could not be parsed. + +For example: + + ~~~ + $myhash = loadyaml('no-file.yaml', {'default'=>'value'}) + ~~~ + +*Type*: rvalue. + +#### `loadjson` + +Loads a JSON file containing an array, string, or hash, and returns the data in the corresponding native data type. + +For example: + + ~~~ + $myhash = loadjson('/etc/puppet/data/myhash.json') + ~~~ + +The second parameter will be returned if the file was not found or could not be parsed. + +For example: + + ~~~ + $myhash = loadjson('no-file.json', {'default'=>'value'}) + ~~~ + *Type*: rvalue. #### `load_module_metadata` |