Class: Toys::Utils::GitCache::RefInfo
- Inherits:
-
Object
- Object
- Toys::Utils::GitCache::RefInfo
- Includes:
- Comparable
- Defined in:
- lib/toys/utils/git_cache.rb
Overview
Information about a git ref used in a cache.
Instance Attribute Summary collapse
-
#last_accessed ⇒ Time?
readonly
The timestamp when this ref was last accessed.
-
#last_updated ⇒ Time?
readonly
The timestamp when this ref was last updated.
-
#ref ⇒ String
readonly
The git ref.
-
#sha ⇒ String
readonly
The git sha last associated with the ref.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Comparison function.
-
#to_h ⇒ Hash
Convert this RefInfo to a hash suitable for JSON output.
Instance Attribute Details
#last_accessed ⇒ Time? (readonly)
The timestamp when this ref was last accessed
666 667 668 |
# File 'lib/toys/utils/git_cache.rb', line 666 def last_accessed @last_accessed end |
#last_updated ⇒ Time? (readonly)
The timestamp when this ref was last updated
673 674 675 |
# File 'lib/toys/utils/git_cache.rb', line 673 def last_updated @last_updated end |
#ref ⇒ String (readonly)
The git ref
652 653 654 |
# File 'lib/toys/utils/git_cache.rb', line 652 def ref @ref end |
#sha ⇒ String (readonly)
The git sha last associated with the ref
659 660 661 |
# File 'lib/toys/utils/git_cache.rb', line 659 def sha @sha end |
Instance Method Details
#<=>(other) ⇒ Integer
Comparison function
696 697 698 |
# File 'lib/toys/utils/git_cache.rb', line 696 def <=>(other) ref <=> other.ref end |
#to_h ⇒ Hash
Convert this RefInfo to a hash suitable for JSON output
680 681 682 683 684 685 686 687 688 |
# File 'lib/toys/utils/git_cache.rb', line 680 def to_h result = { "ref" => ref, "sha" => sha, } result["last_accessed"] = last_accessed.to_i if last_accessed result["last_updated"] = last_updated.to_i if last_updated result end |