Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/get/subcommand/describe/change.rb

Overview

Open String class to inject method to convert a (commit) string into a change.

Instance Method Summary collapse

Instance Method Details

#to_changeObject

Convert the string (as a conventional commit string) into a change type.


53
54
55
56
57
58
59
60
# File 'lib/get/subcommand/describe/change.rb', line 53

def to_change
  groups = Git::CONVENTIONAL_COMMIT_REGEX.match(self)
  return :MAJOR if ChangeHandler.triggers_major?(groups[1], groups[3], !groups[4].nil?)
  return :MINOR if ChangeHandler.triggers_minor?(groups[1], groups[2])
  return :PATCH if ChangeHandler.triggers_patch?(groups[1], groups[2])

  :NONE
end