Class: FeatureMap::Private::ReleaseNotificationBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_map/private/release_notification_builder.rb

Overview

This class is responsible for building a release notification message that can be published to a single team or to an organization as a whole. Currently, the only supported output format is Slack’s Block Kit (see app.slack.com/block-kit-builder).

Class Method Summary collapse

Class Method Details

.build(commits_by_feature) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/feature_map/private/release_notification_builder.rb', line 13

def build(commits_by_feature)
  return [] if commits_by_feature.empty?

  feature_names = commits_by_feature.keys.sort

  feature_names.flat_map.with_index do |feature_name, index|
    # Insert a divider between each feature but not above the first feature nor below the last feature.
    divider = index.zero? ? [] : [{ type: 'divider' }]
    divider + [build_feature_section(feature_name, commits_by_feature[feature_name])]
  end
end