Initial project setup
This commit is contained in:
26
lib/ezdoc/document.rb
Normal file
26
lib/ezdoc/document.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user