Class: Changelog::Notifier::Formatters::ActiveRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/changelog/notifier/formatters/active_record.rb

Overview

Format the given release note hash for ActiveRecord as a multiline text

Instance Method Summary collapse

Constructor Details

#initialize(release_note_hash) ⇒ ActiveRecord



13
14
15
# File 'lib/changelog/notifier/formatters/active_record.rb', line 13

def initialize(release_note_hash)
  @release_note_hash = release_note_hash
end

Instance Method Details

#formatObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/changelog/notifier/formatters/active_record.rb', line 17

def format
  release_note = description_text + "\n\n"

  Array(@release_note_hash[:changes]).each do |change, logs|
    release_note << "#{change.capitalize}\n#{logs.join("\n")}\n\n"
  end

  # TODO : Avoids adding newlines for the last change ...
  release_note.gsub(/\n\z/, '')
end