Class: Rprompt::GitSha

Inherits:
PromptItem show all
Defined in:
lib/rprompt.rb

Instance Attribute Summary

Attributes inherited from PromptItem

#color, #symbol

Instance Method Summary collapse

Methods inherited from PromptItem

#commandResult, #initialize

Methods included from Deco

#termShow

Constructor Details

This class inherits a constructor from Rprompt::PromptItem

Instance Method Details

#shaString

Returns last five numbers form the sha1.

Returns:

  • (String)

    last five numbers form the sha1



54
55
56
# File 'lib/rprompt.rb', line 54

def sha
	commandResult.chomp[-6,6]
end

#showString

Returns terminal representation of the number returned by ‘sha’.

Returns:

  • (String)

    terminal representation of the number returned by ‘sha’



59
60
61
# File 'lib/rprompt.rb', line 59

def show
	termShow({:color => color, :symbol => symbol, :content => sha})
end