Class: Spoom::Git::Commit

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_line(string) ⇒ Object

Parse a line formatted as ‘%h %at` into a `Commit` : (String string) -> Commit?



10
11
12
13
14
15
16
# File 'lib/spoom/context/git.rb', line 10

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

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

Instance Method Details

#timestampObject

: -> Integer



23
24
25
# File 'lib/spoom/context/git.rb', line 23

def timestamp
  time.to_i
end