examples/simple.rb in doc_storage-0.9 vs examples/simple.rb in doc_storage-1.0

- old
+ new

@@ -9,18 +9,14 @@ "Priority" => "urgent" }, "We should finish the documentation ASAP." ) -# Parse a file -document = File.open("#{dir}/simple.txt", "r") do |f| - DocStorage::SimpleDocument.parse(f) -end +# Load from a file +document = DocStorage::SimpleDocument.load_file("examples/simple.txt") # Document manipulation document.headers["Tags"] = "example" document.body += "Nulla mi dui, pellentesque et accumsan vitae, mattis et velit." # Save the modified document -File.open("#{dir}/simple_modified.txt", "w") do |f| - f.write(document) -end +document.save_file("#{dir}/simple_modified.txt")