27 lines
382 B
Ruby
27 lines
382 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Ezdoc
|
|
class Document
|
|
attr_reader :content
|
|
|
|
def self.create(path, &block)
|
|
doc = new
|
|
block.call(doc)
|
|
doc.save(path)
|
|
doc
|
|
end
|
|
|
|
def initialize
|
|
@content = []
|
|
end
|
|
|
|
def text(value)
|
|
@content << { text: value }
|
|
end
|
|
|
|
def save(path)
|
|
Package.new(self).save(path)
|
|
end
|
|
end
|
|
end
|