Class: ConventionalChangelog::Writer

Inherits:
File
  • Object
show all
Defined in:
lib/conventional_changelog/writer.rb

Direct Known Subclasses

ByDateWriter, ByVersionWriter

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ Writer

Returns a new instance of Writer.



19
20
21
22
23
24
25
# File 'lib/conventional_changelog/writer.rb', line 19

def initialize(file_name)
  FileUtils.touch file_name
  super file_name, 'r+'

  @new_body = StringIO.new
  @previous_body = read
end

Instance Method Details

#write!(options) ⇒ Object



27
28
29
30
31
32
# File 'lib/conventional_changelog/writer.rb', line 27

def write!(options)
  build_new_lines options
  seek 0
  write @new_body.string
  write @previous_body
end