Class: Gistory::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/gistory/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dateObject (readonly)

Returns the value of attribute date.



7
8
9
# File 'lib/gistory/commit.rb', line 7

def date
  @date
end

#short_hashObject (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_sObject



15
16
17
# File 'lib/gistory/commit.rb', line 15

def to_s
  "Commit #{short_hash} on #{date}"
end