Class: Gitmain::Commit
- Inherits:
-
Object
- Object
- Gitmain::Commit
- Defined in:
- lib/gitmain/commit.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #author_email ⇒ Object
- #author_name ⇒ Object
-
#initialize(repository, id) ⇒ Commit
constructor
A new instance of Commit.
- #message ⇒ Object
- #parent_ids ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(repository, id) ⇒ Commit
Returns a new instance of Commit.
5 6 7 8 9 10 |
# File 'lib/gitmain/commit.rb', line 5 def initialize(repository, id) raise ArgumentError, 'provide a valid repository' unless repository.kind_of?(Gitmain::Repository) raise ArgumentError, 'provide a valid commit id' unless id.to_s.match(/\A[0-9a-f]{40}\z/) @repository = repository @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/gitmain/commit.rb', line 3 def id @id end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
3 4 5 |
# File 'lib/gitmain/commit.rb', line 3 def repository @repository end |
Instance Method Details
#author_email ⇒ Object
12 13 14 |
# File 'lib/gitmain/commit.rb', line 12 def _commit&.[:email] end |
#author_name ⇒ Object
16 17 18 |
# File 'lib/gitmain/commit.rb', line 16 def _commit&.[:name] end |
#message ⇒ Object
20 21 22 |
# File 'lib/gitmain/commit.rb', line 20 def _commit&. end |
#parent_ids ⇒ Object
24 25 26 |
# File 'lib/gitmain/commit.rb', line 24 def parent_ids _commit&.parent_ids end |
#time ⇒ Object
28 29 30 |
# File 'lib/gitmain/commit.rb', line 28 def time _commit&.time end |