lib/hieracles/formats/yaml.rb in hieracles-0.0.6 vs lib/hieracles/formats/yaml.rb in hieracles-0.1.0

- old
+ new

@@ -17,19 +17,25 @@ def modules(_) @node.modules.to_yaml end - def params(args) - commented_yaml_tree(true) + def params(args = nil) + if args + args = args.join(' ') + end + commented_yaml_tree(args, true) end - def allparams(args) - commented_yaml_tree(false) + def allparams(args = nil) + if args + args = args.join('.') + end + commented_yaml_tree(args, false) end - def commented_yaml_tree(without_common = true) + def commented_yaml_tree(filter, without_common = true) tree = @node.params_tree(without_common) params = Hash[@node.params(without_common)] mergetree('---', [], tree, params) end @@ -56,9 +62,25 @@ output end def add_string(output, key, leaf, params, indent) output += leaf + if params["#{key.join('.')}"] + output += " # " + params[key.join('.')][0][:file] + end + output + end + + def add_trueclass(output, key, leaf, params, indent) + output += 'true' + if params["#{key.join('.')}"] + output += " # " + params[key.join('.')][0][:file] + end + output + end + + def add_falseclass(output, key, leaf, params, indent) + output += 'false' if params["#{key.join('.')}"] output += " # " + params[key.join('.')][0][:file] end output end