class GhostWriter::Document attr_reader :title, :description, :location, :url_example, :param_example, :status_example, :response_example, :output, :relative_path def initialize(output, attrs) extend(GhostWriter::Format::Markdown) @output = output @relative_path = Pathname.new(output).relative_path_from(GhostWriter.output_path) @title = attrs[:title] @description = attrs[:description] @location = attrs[:location] @url_example = attrs[:url_example] @param_example = attrs[:param_example] @status_example = attrs[:status_example] @response_example = attrs[:response_example] end def write_file unless File.exist?(File.dirname(output)) FileUtils.mkdir_p(File.dirname(output)) end doc = File.open(output, "w") doc.write paragraph(<