Class: Rprompt::GitNumbers

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

#numberOfFilesInteger

Returns number of files returned by a git command.

Returns:

  • (Integer)

    number of files returned by a git command



30
31
32
# File 'lib/rprompt.rb', line 30

def numberOfFiles
	commandResult.split(/\r?\n/).count
end

#showString

Returns terminal representation of the number of files.

Returns:

  • (String)

    terminal representation of the number of files



35
36
37
# File 'lib/rprompt.rb', line 35

def show
	numberOfFiles != 0 ? termShow({:color => color, :symbol => symbol, :content => numberOfFiles}) : ''
end