Module: Mdtoc::Writer

Extended by:
T::Sig
Defined in:
lib/mdtoc/writer.rb

Constant Summary collapse

COMMENT_BEGIN =
'<!-- mdtoc -->'
COMMENT_END =
'<!-- mdtoc-end -->'

Class Method Summary collapse

Class Method Details

.write(toc, path, append, create) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/mdtoc/writer.rb', line 13

def write(toc, path, append, create)
  validate_path(path, create)
  new_content = content(toc, path, append)
  File.open(path, 'w') do |f|
    f.write(new_content)
  end
end