Class: Gglog::CommitMessage
- Inherits:
-
Object
- Object
- Gglog::CommitMessage
- Defined in:
- lib/gglog/commit_message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#first_line ⇒ Object
readonly
Returns the value of attribute first_line.
-
#first_line_included_snippet ⇒ Object
Returns the value of attribute first_line_included_snippet.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(first_line, body, repository, sha) ⇒ CommitMessage
constructor
A new instance of CommitMessage.
Constructor Details
#initialize(first_line, body, repository, sha) ⇒ CommitMessage
Returns a new instance of CommitMessage.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gglog/commit_message.rb', line 19 def initialize(first_line, body, repository, sha) @first_line = first_line || "" @body = body || "" @repository = repository || "" @sha = sha || "" @first_line = @first_line.force_encoding('UTF-8') @body = @body.force_encoding('UTF-8') @repository = @repository.force_encoding('utf-8') @sha = @sha.force_encoding('utf-8') end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
15 16 17 |
# File 'lib/gglog/commit_message.rb', line 15 def body @body end |
#first_line ⇒ Object (readonly)
Returns the value of attribute first_line.
15 16 17 |
# File 'lib/gglog/commit_message.rb', line 15 def first_line @first_line end |
#first_line_included_snippet ⇒ Object
Returns the value of attribute first_line_included_snippet.
17 18 19 |
# File 'lib/gglog/commit_message.rb', line 17 def first_line_included_snippet @first_line_included_snippet end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
16 17 18 |
# File 'lib/gglog/commit_message.rb', line 16 def repository @repository end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
16 17 18 |
# File 'lib/gglog/commit_message.rb', line 16 def sha @sha end |
Class Method Details
.new_from_commit_object(commit, repository_name) ⇒ Object
5 6 7 8 |
# File 'lib/gglog/commit_message.rb', line 5 def new_from_commit_object(commit, repository_name) first_line, _, body = commit..split("\n", 3) self.new(first_line, body, repository_name, commit.oid) end |
.new_from_record(commit_message) ⇒ Object
10 11 12 13 |
# File 'lib/gglog/commit_message.rb', line 10 def new_from_record() self.new(.first_line, .body, .repository, .sha) end |