Class: Spoom::Git::Commit
- Inherits:
-
T::Struct
- Object
- T::Struct
- Spoom::Git::Commit
- Defined in:
- lib/spoom/context/git.rb
Class Method Summary collapse
-
.parse_line(string) ⇒ Object
Parse a line formatted as ‘%h %at` into a `Commit` : (String string) -> Commit?.
Instance Method Summary collapse
-
#timestamp ⇒ Object
: -> Integer.
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
#timestamp ⇒ Object
: -> Integer
23 24 25 |
# File 'lib/spoom/context/git.rb', line 23 def time.to_i end |