Class: Gistory::Commit
- Inherits:
-
Object
- Object
- Gistory::Commit
- Defined in:
- lib/gistory/commit.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#short_hash ⇒ Object
readonly
Returns the value of attribute short_hash.
Instance Method Summary collapse
-
#initialize(short_hash:, date:) ⇒ Commit
constructor
A new instance of Commit.
- #to_s ⇒ Object
Constructor Details
#initialize(short_hash:, date:) ⇒ Commit
Returns a new instance of Commit.
9 10 11 12 13 |
# File 'lib/gistory/commit.rb', line 9 def initialize(short_hash:, date:) @short_hash = short_hash @date = DateTime.parse(date.to_s) freeze end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
7 8 9 |
# File 'lib/gistory/commit.rb', line 7 def date @date end |
#short_hash ⇒ Object (readonly)
Returns the value of attribute short_hash.
7 8 9 |
# File 'lib/gistory/commit.rb', line 7 def short_hash @short_hash end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/gistory/commit.rb', line 15 def to_s "Commit #{short_hash} on #{date}" end |