Class: GitRev::Sha
- Inherits:
-
Object
- Object
- GitRev::Sha
- Defined in:
- lib/git_rev/sha.rb
Instance Method Summary collapse
- #full ⇒ Object
-
#initialize(options = {}) ⇒ Sha
constructor
A new instance of Sha.
- #short ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Sha
Returns a new instance of Sha.
4 5 6 7 8 9 10 |
# File 'lib/git_rev/sha.rb', line 4 def initialize(={}) repository = [:repository] || Dir.pwd cache = .has_key?(:cache) ? [:cache] : true @repository=File.(repository) @cache = cache ensure_repository! end |
Instance Method Details
#full ⇒ Object
12 13 14 |
# File 'lib/git_rev/sha.rb', line 12 def full cached? && @revision || load_revision end |
#short ⇒ Object
16 17 18 |
# File 'lib/git_rev/sha.rb', line 16 def short full[0, 7] end |