Class: Spoom::Git::Commit

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/spoom/context/git.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_line(string) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/spoom/context/git.rb', line 14

def parse_line(string)
  sha, epoch = string.split(" ", 2)
  return nil unless sha && epoch

  time = Time.strptime(epoch, "%s")
  Commit.new(sha: sha, time: time)
end

Instance Method Details

#timestampObject



27
28
29
# File 'lib/spoom/context/git.rb', line 27

def timestamp
  time.to_i
end