Sha256: 48849ab681df863b729b4330bde70ab00926a37b8dfca243dc52412f385b304a

Contents?: true

Size: 894 Bytes

Versions: 3

Compression:

Stored size: 894 Bytes

Contents

dir = File.dirname(__FILE__)

require "#{dir}/../lib/doc_storage"

# Create a new document with two parts
document = DocStorage::MultipartDocument.new([
  DocStorage::SimpleDocument.new(
    {
      "Title"    => "Finishing the documentation",
      "Priority" => "urgent"
    },
    "We should finish the documentation ASAP."
  ),
  DocStorage::SimpleDocument.new(
    {
      "Title"    => "Finishing the code",
      "Priority" => "more urgent"
    },
    "But we should finish the code first!"
  ),
])

# Load from a file
document = DocStorage::MultipartDocument.load_file("examples/multipart.txt")

# Document manipulation
document.parts << DocStorage::SimpleDocument.new(
  {
    "Author"   => "Middle man",
    "Datetime" => "2009-11-01 21:15:33",
  },
  "I think your article is neither good nor bad."
)

# Save the modified document
document.save_file("#{dir}/multipart_modified.txt")

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doc_storage-1.0.2 examples/multipart.rb
doc_storage-1.0.1 examples/multipart.rb
doc_storage-1.0 examples/multipart.rb