class RspecApiDocumentation::Writers::GeneralMarkupWriter
Base class for writers that write HTML
Constants
- INDEX_FILE_NAME
Public Instance Methods
extension()
click to toggle source
# File lib/rspec_api_documentation/writers/general_markup_writer.rb, line 31 def extension raise 'Parent class. This method should not be called.' end
index_file_name()
click to toggle source
# File lib/rspec_api_documentation/writers/general_markup_writer.rb, line 27 def index_file_name INDEX_FILE_NAME end
write()
click to toggle source
Write out the generated documentation
# File lib/rspec_api_documentation/writers/general_markup_writer.rb, line 8 def write if render_options.fetch(:index, true) File.open(configuration.docs_dir.join(index_file_name + '.' + extension), "w+") do |f| f.write markup_index_class.new(index, configuration).render end end if render_options.fetch(:examples, true) index.examples.each do |example| markup_example = markup_example_class.new(example, configuration) FileUtils.mkdir_p(configuration.docs_dir.join(markup_example.dirname)) File.open(configuration.docs_dir.join(markup_example.dirname, markup_example.filename), "w+") do |f| f.write markup_example.render end end end end
Private Instance Methods
render_options()
click to toggle source
# File lib/rspec_api_documentation/writers/general_markup_writer.rb, line 37 def render_options { index: true, examples: true } end