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
21 22 23 24 25 26 27 28 |
# File 'lib/cookbook-release/commit.rb', line 21 def color case true when major? :red else :grey end end |
#major? ⇒ Boolean
9 10 11 |
# File 'lib/cookbook-release/commit.rb', line 9 def major? !!(self[:subject] =~ /breaking/i) end |
#minor? ⇒ Boolean
17 18 19 |
# File 'lib/cookbook-release/commit.rb', line 17 def minor? !(major? || patch?) end |
#patch? ⇒ Boolean
13 14 15 |
# File 'lib/cookbook-release/commit.rb', line 13 def patch? !!(self[:subject] =~ /\bfix\b/i) || !!(self[:subject] =~ /\bbugfix\b/i) end |