Sha256: 37b651f4df38f80620c316f0a7d62c5f47a8f1faa89efac6970b9ef18b5f36af

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module GFSM
  module Data
    class ChangeType
      attr_reader :matcher, :title, :bump_type, :priority, :commits

      def initialize(matcher, title, bump_type, priority)
        @matcher = matcher
        @title = title
        @bump_type = bump_type
        @priority = priority
        @commits = []
      end

      def bump_major?
        @bump_type == :major
      end
      
      def bump_minor?
        @bump_type == :minor
      end
      
      def bump_patch?
        @bump_type == :patch
      end

      def to_s
        @title
      end

      def to_changelog_entry
        "### #{@title}"
      end

      def self.find_highest_bump(change_types)
        highest_bump = :patch

        change_types.each do |change_type|
          if change_type.bump_major?
            highest_bump = :major

            # Early exit, it can't go higher than this!
            break
          elsif change_type.bump_minor?
            highest_bump = :minor
          end
        end

        highest_bump
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gfsm-0.7.0 lib/data/change_type.rb
gfsm-0.6.0 lib/data/change_type.rb
gfsm-0.5.1 lib/data/change_type.rb
gfsm-0.5.0 lib/data/change_type.rb
gfsm-0.4.1 lib/data/change_type.rb
gfsm-0.4.0 lib/data/change_type.rb
gfsm-0.3.2 lib/data/change_type.rb
gfsm-0.3.1 lib/data/change_type.rb
gfsm-0.3.0 lib/data/change_type.rb
gfsm-0.2.0 lib/data/change_type.rb
gfsm-0.1.4 lib/data/change_type.rb
gfsm-0.1.3 lib/data/change_type.rb
gfsm-0.1.2 lib/data/change_type.rb