Class: Commit
- Inherits:
-
Object
- Object
- Commit
- Extended by:
- Forwardable
- Defined in:
- lib/cookbook-release/commit.rb
Instance Method Summary collapse
- #color ⇒ Object
-
#initialize(hash) ⇒ Commit
constructor
A new instance of Commit.
- #major? ⇒ Boolean
- #minor? ⇒ Boolean
- #patch? ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Commit
Returns a new instance of Commit.
5 6 7 |
# File 'lib/cookbook-release/commit.rb', line 5 def initialize(hash) @hash = hash end |
Instance Method Details
#color ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/cookbook-release/commit.rb', line 32 def color case true when major? :red else :grey end end |
#major? ⇒ Boolean
9 10 11 12 13 14 15 16 |
# File 'lib/cookbook-release/commit.rb', line 9 def major? [ /breaking/i, /\[major\]/i ].any? do |r| self[:subject] =~ r end end |
#minor? ⇒ Boolean
28 29 30 |
# File 'lib/cookbook-release/commit.rb', line 28 def minor? !(major? || patch?) end |
#patch? ⇒ Boolean
18 19 20 21 22 23 24 25 26 |
# File 'lib/cookbook-release/commit.rb', line 18 def patch? [ /\bfix\b/i, /\bbugfix\b/i, /\[patch\]/i ].any? do |r| self[:subject] =~ r end end |