class Rprompt::GitTrack

Public Class Methods

new(config, state) click to toggle source

@param (see PromptItem#initialize) @param [Symbol] state (“ahead” or “behind”)

Calls superclass method Rprompt::PromptItem::new
# File lib/rprompt.rb, line 67
def initialize(config, state)
        @state = state
        super(config)
end

Public Instance Methods

count() click to toggle source

@return [Integer] number of commits ahead or behind remote @note works only if remote branch is tracked

# File lib/rprompt.rb, line 74
def count
        commandResult.match(/#{@state}\s+([0-9]+)/)
        $1.to_i
end
show() click to toggle source

@return [String] terminal representation of the tracking

# File lib/rprompt.rb, line 80
def show
        count != 0 ? termShow({:color => color, :symbol => symbol, :content => count}) : ''
end