Class: GitTracker::CommitMessage
- Inherits:
-
Object
- Object
- GitTracker::CommitMessage
- Defined in:
- lib/git_tracker/commit_message.rb
Instance Method Summary collapse
- #append(text) ⇒ Object
-
#initialize(file) ⇒ CommitMessage
constructor
A new instance of CommitMessage.
- #keyword ⇒ Object
- #mentions_story?(number) ⇒ Boolean
Constructor Details
#initialize(file) ⇒ CommitMessage
Returns a new instance of CommitMessage.
4 5 6 7 |
# File 'lib/git_tracker/commit_message.rb', line 4 def initialize(file) @file = file @message = File.read(@file) end |
Instance Method Details
#append(text) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/git_tracker/commit_message.rb', line 18 def append(text) body, postscript = parse(@message) = (body, text, postscript) File.open(@file, 'w') do |f| f.write() end end |
#keyword ⇒ Object
13 14 15 16 |
# File 'lib/git_tracker/commit_message.rb', line 13 def keyword @message =~ /\[(fix|fixes|fixed|complete|completes|completed|finish|finishes|finished|deliver|delivers|delivered)\]/io $1 end |
#mentions_story?(number) ⇒ Boolean
9 10 11 |
# File 'lib/git_tracker/commit_message.rb', line 9 def mentions_story?(number) @message =~ /^(?!#).*\[(\w+\s)?(#\d+\s)*##{number}(\s#\d+)*(\s\w+)?\]/io end |