lib/yaml_master.rb in yaml_master-1.0.0 vs lib/yaml_master.rb in yaml_master-1.0.1
- old
+ new
@@ -27,25 +27,25 @@
parser = YAML::Parser.new
parser.handler = YamlMaster::YAMLTreeBuilder.new(@master_path, @properties, parser)
@tree = parser.parse(yaml).handler.root
@master = @tree.to_ruby[0]
+ end
- raise "yaml_master key is necessary on toplevel" unless @master["yaml_master"]
- raise "data key is necessary on toplevel" unless @master["data"]
+ def dump(output = nil, options = {})
+ yaml = @tree.to_yaml
+ write_to_output(yaml, output, options[:verbose])
end
def generate(key, output = nil, options = {})
+ raise "data key is necessary on toplevel" unless @master["data"]
yaml = YAML.dump(fetch_data_from_master(key))
write_to_output(yaml, output, options[:verbose])
end
- def dump(output = nil, options = {})
- yaml = @tree.to_yaml
- write_to_output(yaml, output, options[:verbose])
- end
-
def generate_all(options = {})
+ raise "yaml_master key is necessary on toplevel" unless @master["yaml_master"]
+ raise "data key is necessary on toplevel" unless @master["data"]
@master["yaml_master"].each do |key, output|
generate(key, output, options)
end
end