Class: CIJoe::Commit
- Inherits:
-
Struct
- Object
- Struct
- CIJoe::Commit
- Defined in:
- lib/cijoe/commit.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
-
#sha ⇒ Object
Returns the value of attribute sha.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #author ⇒ Object
- #committed_at ⇒ Object
- #message ⇒ Object
- #raw_commit ⇒ Object
- #raw_commit_lines ⇒ Object
- #url ⇒ Object
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project
2 3 4 |
# File 'lib/cijoe/commit.rb', line 2 def project @project end |
#sha ⇒ Object
Returns the value of attribute sha
2 3 4 |
# File 'lib/cijoe/commit.rb', line 2 def sha @sha end |
#user ⇒ Object
Returns the value of attribute user
2 3 4 |
# File 'lib/cijoe/commit.rb', line 2 def user @user end |
Instance Method Details
#author ⇒ Object
7 8 9 |
# File 'lib/cijoe/commit.rb', line 7 def raw_commit_lines.grep(/Author:/).first.split(':', 2)[-1] end |
#committed_at ⇒ Object
11 12 13 |
# File 'lib/cijoe/commit.rb', line 11 def committed_at raw_commit_lines.grep(/Date:/).first.split(':', 2)[-1] end |
#message ⇒ Object
15 16 17 |
# File 'lib/cijoe/commit.rb', line 15 def raw_commit.split("\n\n", 3)[1].to_s.strip end |
#raw_commit ⇒ Object
19 20 21 |
# File 'lib/cijoe/commit.rb', line 19 def raw_commit @raw_commit ||= `git show #{sha}`.chomp end |
#raw_commit_lines ⇒ Object
23 24 25 |
# File 'lib/cijoe/commit.rb', line 23 def raw_commit_lines @raw_commit_lines ||= raw_commit.split("\n") end |
#url ⇒ Object
3 4 5 |
# File 'lib/cijoe/commit.rb', line 3 def url "http://github.com/#{user}/#{project}/commit/#{sha}" end |