Class: YDoc::MarkdownBuilder
- Inherits:
-
Object
- Object
- YDoc::MarkdownBuilder
- Defined in:
- lib/appcom-ydoc-ruby/markdown/markdown_builder.rb
Instance Method Summary collapse
-
#initialize ⇒ MarkdownBuilder
constructor
A new instance of MarkdownBuilder.
- #to_markdown(file_or_directory, output_directory) ⇒ Object
Constructor Details
#initialize ⇒ MarkdownBuilder
Returns a new instance of MarkdownBuilder.
7 8 |
# File 'lib/appcom-ydoc-ruby/markdown/markdown_builder.rb', line 7 def initialize end |
Instance Method Details
#to_markdown(file_or_directory, output_directory) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/appcom-ydoc-ruby/markdown/markdown_builder.rb', line 10 def to_markdown file_or_directory, output_directory is_file = File.file?(file_or_directory) && File.exists?(file_or_directory) is_directory = File.directory?(file_or_directory) && File.exists?(file_or_directory) FileUtils.mkdir_p output_directory if is_file file_to_markdown file_or_directory, output_directory elsif is_directory Dir["#{file_or_directory}/*.yaml"].each { |file| file_to_markdown file, output_directory } end end |