Class: Manifestly::Commit
- Inherits:
-
Object
- Object
- Manifestly::Commit
- Defined in:
- lib/manifestly/commit.rb
Instance Method Summary collapse
-
#initialize(commit) ⇒ Commit
constructor
A new instance of Commit.
- #is_pr? ⇒ Boolean
- #pr_number ⇒ Object
- #summarized_message ⇒ Object
Constructor Details
#initialize(commit) ⇒ Commit
Returns a new instance of Commit.
4 5 6 |
# File 'lib/manifestly/commit.rb', line 4 def initialize(commit) @commit = commit end |
Instance Method Details
#is_pr? ⇒ Boolean
8 9 10 |
# File 'lib/manifestly/commit.rb', line 8 def is_pr? @commit..starts_with?("Merge pull request") end |
#pr_number ⇒ Object
12 13 14 15 |
# File 'lib/manifestly/commit.rb', line 12 def pr_number match = @commit..match(/Merge pull request #(\d+)/) match.nil? ? nil : match[1] end |
#summarized_message ⇒ Object
17 18 19 20 21 22 |
# File 'lib/manifestly/commit.rb', line 17 def @commit. .gsub(/Merge pull request (#\w+)( from [\w-]+\/[\w-]+)/, 'PR \1') .gsub("\n",' ') .gsub(/\s+/, ' ')[0..79] end |