Class: GFSM::Data::ChangeType

Inherits:
Object
  • Object
show all
Defined in:
lib/data/change_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matcher, title, bump_type, priority, ignore_on_changelog) ⇒ ChangeType

Returns a new instance of ChangeType.



8
9
10
11
12
13
14
15
# File 'lib/data/change_type.rb', line 8

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

Instance Attribute Details

#bump_typeObject (readonly)

Returns the value of attribute bump_type.



6
7
8
# File 'lib/data/change_type.rb', line 6

def bump_type
  @bump_type
end

#commitsObject (readonly)

Returns the value of attribute commits.



6
7
8
# File 'lib/data/change_type.rb', line 6

def commits
  @commits
end

#ignore_on_changelogObject (readonly)

Returns the value of attribute ignore_on_changelog.



6
7
8
# File 'lib/data/change_type.rb', line 6

def ignore_on_changelog
  @ignore_on_changelog
end

#matcherObject (readonly)

Returns the value of attribute matcher.



6
7
8
# File 'lib/data/change_type.rb', line 6

def matcher
  @matcher
end

#priorityObject (readonly)

Returns the value of attribute priority.



6
7
8
# File 'lib/data/change_type.rb', line 6

def priority
  @priority
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/data/change_type.rb', line 6

def title
  @title
end

Class Method Details

.find_highest_bump(change_types) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/data/change_type.rb', line 41

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

Instance Method Details

#bump_major?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/data/change_type.rb', line 17

def bump_major?
  @bump_type == :major
end

#bump_minor?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/data/change_type.rb', line 21

def bump_minor?
  @bump_type == :minor
end

#bump_patch?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/data/change_type.rb', line 25

def bump_patch?
  @bump_type == :patch
end

#ignore_on_changelog?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/data/change_type.rb', line 29

def ignore_on_changelog?
  @ignore_on_changelog
end

#to_changelog_entryObject



37
38
39
# File 'lib/data/change_type.rb', line 37

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

#to_sObject



33
34
35
# File 'lib/data/change_type.rb', line 33

def to_s
  @title
end