Files
Notare/lib/ezdoc/document.rb

35 lines
565 B
Ruby

# frozen_string_literal: true
module Ezdoc
class Document
include Builder
attr_reader :nodes
def self.create(path, &block)
doc = new
block.call(doc)
doc.save(path)
doc
end
def initialize
@nodes = []
@format_stack = []
@current_target = nil
@current_list = nil
@current_table = nil
@current_row = nil
@num_id_counter = 0
end
def save(path)
Package.new(self).save(path)
end
def lists
@nodes.select { |n| n.is_a?(Nodes::List) }
end
end
end