Class: Historian::CommitMessage
- Inherits:
-
Object
- Object
- Historian::CommitMessage
- Defined in:
- lib/historian/commit_message.rb
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#suppressed ⇒ Object
readonly
Returns the value of attribute suppressed.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(line) ⇒ CommitMessage
constructor
A new instance of CommitMessage.
- #significance ⇒ Object
- #suppressed? ⇒ Boolean
- #to_message_s ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(line) ⇒ CommitMessage
Returns a new instance of CommitMessage.
6 7 8 9 10 11 12 13 14 |
# File 'lib/historian/commit_message.rb', line 6 def initialize(line) if line =~ /^([!bmM])(#?):(.*[0-9a-zA-Z].*)$/ @token = $1 @suppressed = true if $2 == "#" @line = $3 else @line = line end end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
4 5 6 |
# File 'lib/historian/commit_message.rb', line 4 def line @line end |
#suppressed ⇒ Object (readonly)
Returns the value of attribute suppressed.
4 5 6 |
# File 'lib/historian/commit_message.rb', line 4 def suppressed @suppressed end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'lib/historian/commit_message.rb', line 4 def token @token end |
Class Method Details
.parse_line(line) ⇒ Object
37 38 39 |
# File 'lib/historian/commit_message.rb', line 37 def self.parse_line(line) new line end |
Instance Method Details
#significance ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/historian/commit_message.rb', line 16 def significance case token when "b"; :patch when "m"; :minor when "M"; :major when "!"; :release end end |
#suppressed? ⇒ Boolean
25 26 27 |
# File 'lib/historian/commit_message.rb', line 25 def suppressed? @suppressed == true end |
#to_message_s ⇒ Object
33 34 35 |
# File 'lib/historian/commit_message.rb', line 33 def line.gsub /^\W*/, '' if significance end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/historian/commit_message.rb', line 29 def to_s line end |