Module: StepUp::NotesHash

Defined in:
lib/step-up/ranged_notes.rb

Instance Method Summary collapse

Instance Method Details

#to_changelog(options = {}) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/step-up/ranged_notes.rb', line 161

def to_changelog(options = {})
  changelog = []

  if options[:custom_message]
    changelog << "Custom message:\n"
    changelog << parse_message(options[:custom_message])
    changelog << ""
  end

  CONFIG.notes_sections.names.each do |section|
    next unless has_key?(section)
    changelog << "#{ CONFIG.notes_sections.label(section) }\n"
    self[section].each do |note|
      message = note[1]
      message = message.sub(/$/, " (#{ note[0] })") if options[:mode] == :with_objects
      changelog << parse_message(message)
    end
    changelog << ""
  end
  changelog.join("\n").rstrip
end