Class: PrChangelog::NotReleasedChanges

Inherits:
Object
  • Object
show all
Defined in:
lib/pr_changelog/not_released_changes.rb

Overview

Calculates a list of not released changes from ‘base_ref` to `current_ref` those changes consist of the merged pull-request title

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commits_strategy) ⇒ NotReleasedChanges

Returns a new instance of NotReleasedChanges.



9
10
11
# File 'lib/pr_changelog/not_released_changes.rb', line 9

def initialize(commits_strategy)
  @commits_strategy = commits_strategy
end

Instance Attribute Details

#commits_strategyObject (readonly)

Returns the value of attribute commits_strategy.



7
8
9
# File 'lib/pr_changelog/not_released_changes.rb', line 7

def commits_strategy
  @commits_strategy
end

Instance Method Details

#emoji_tagsObject



13
14
15
16
17
18
19
20
21
# File 'lib/pr_changelog/not_released_changes.rb', line 13

def emoji_tags
  tags = {}

  PrChangelog.config.tags.each_with_index do |item, index|
    tags[item[:prefix]] = Tag.new(item[:emoji], item[:title], index)
  end

  tags
end

#formatted_changelogObject



23
24
25
26
27
28
29
# File 'lib/pr_changelog/not_released_changes.rb', line 23

def formatted_changelog
  if parsed_change_list.count.positive?
    parsed_change_list.map(&:to_s).join("\n")
  else
    no_changes_found
  end
end

#grouped_formatted_changelogObject



31
32
33
34
35
36
37
# File 'lib/pr_changelog/not_released_changes.rb', line 31

def grouped_formatted_changelog
  if parsed_change_list.count.positive?
    GroupedChanges.new(parsed_change_list, emoji_tags).to_s
  else
    no_changes_found
  end
end