Class: GitRev::Sha

Inherits:
Object
  • Object
show all
Defined in:
lib/git_rev/sha.rb

Instance Method Summary collapse

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(options={})
  repository = options[:repository] || Dir.pwd
  cache = options.has_key?(:cache) ? options[:cache] : true
  @repository=File.expand_path(repository)
  @cache = cache
  ensure_repository!
end

Instance Method Details

#fullObject



12
13
14
# File 'lib/git_rev/sha.rb', line 12

def full
  cached? && @revision || load_revision
end

#shortObject



16
17
18
# File 'lib/git_rev/sha.rb', line 16

def short
  full[0, 7]
end