Class: MarkdownRubyDocumentation::WriteMarkdownToDisk
- Inherits:
-
Object
- Object
- MarkdownRubyDocumentation::WriteMarkdownToDisk
- Defined in:
- lib/markdown_ruby_documentation/write_markdown_to_disk.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#relative_dir ⇒ Object
readonly
Returns the value of attribute relative_dir.
-
#skip_if_blank ⇒ Object
readonly
Returns the value of attribute skip_if_blank.
Instance Method Summary collapse
- #call(name:, text:) ⇒ Object
-
#initialize(dir:, skip_if_blank: false, relative_dir:) ⇒ WriteMarkdownToDisk
constructor
A new instance of WriteMarkdownToDisk.
Constructor Details
#initialize(dir:, skip_if_blank: false, relative_dir:) ⇒ WriteMarkdownToDisk
Returns a new instance of WriteMarkdownToDisk.
6 7 8 9 10 |
# File 'lib/markdown_ruby_documentation/write_markdown_to_disk.rb', line 6 def initialize(dir:, skip_if_blank: false, relative_dir:) @dir = dir @skip_if_blank = skip_if_blank @relative_dir = relative_dir end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
4 5 6 |
# File 'lib/markdown_ruby_documentation/write_markdown_to_disk.rb', line 4 def dir @dir end |
#relative_dir ⇒ Object (readonly)
Returns the value of attribute relative_dir.
4 5 6 |
# File 'lib/markdown_ruby_documentation/write_markdown_to_disk.rb', line 4 def relative_dir @relative_dir end |
#skip_if_blank ⇒ Object (readonly)
Returns the value of attribute skip_if_blank.
4 5 6 |
# File 'lib/markdown_ruby_documentation/write_markdown_to_disk.rb', line 4 def skip_if_blank @skip_if_blank end |
Instance Method Details
#call(name:, text:) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/markdown_ruby_documentation/write_markdown_to_disk.rb', line 12 def call(name:, text:) return if skip_save?(text, name) name = name.gsub(dir, "").underscore file = "#{name}.md" path = File.join(dir, file) return if file_exists_with?(text, path) write_file(path, text) end |