Class: RspecApiDocumentation::Writers::SlateWriter
- Inherits:
-
MarkdownWriter
- Object
- Writer
- GeneralMarkupWriter
- MarkdownWriter
- RspecApiDocumentation::Writers::SlateWriter
- Defined in:
- lib/rspec_api_documentation/writers/slate_writer.rb
Constant Summary collapse
- FILENAME =
'_generated_examples'
Constants inherited from MarkdownWriter
Constants inherited from GeneralMarkupWriter
GeneralMarkupWriter::INDEX_FILE_NAME
Instance Attribute Summary
Attributes inherited from Writer
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from MarkdownWriter
#extension, #markup_index_class
Methods inherited from GeneralMarkupWriter
Methods inherited from Writer
Constructor Details
This class inherits a constructor from RspecApiDocumentation::Writers::Writer
Class Method Details
.clear_docs(docs_dir) ⇒ Object
7 8 9 10 |
# File 'lib/rspec_api_documentation/writers/slate_writer.rb', line 7 def self.clear_docs(docs_dir) FileUtils.mkdir_p(docs_dir) FileUtils.rm Dir[File.join docs_dir, "#{FILENAME}.*"] end |
Instance Method Details
#markup_example_class ⇒ Object
12 13 14 |
# File 'lib/rspec_api_documentation/writers/slate_writer.rb', line 12 def markup_example_class RspecApiDocumentation::Views::SlateExample end |
#write ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rspec_api_documentation/writers/slate_writer.rb', line 16 def write File.open(configuration.docs_dir.join("#{FILENAME}.#{extension}"), 'w+') do |file| file.write "# #{configuration.api_name}\n\n" index.examples.sort_by!(&:description) unless configuration.keep_source_order index.examples.each do |example| markup_example = markup_example_class.new(example, configuration) file.write markup_example.render end end end |