Class: Rprompt::PromptItem

Inherits:
Object
  • Object
show all
Includes:
Deco
Defined in:
lib/rprompt.rb

Direct Known Subclasses

GitBranch, GitNumbers, GitSha, GitTrack, RvmGemset, RvmRuby

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Deco

#termShow

Constructor Details

#initialize(config) ⇒ PromptItem

Returns a new instance of PromptItem.

Parameters:

  • config (Hash)

    Prompt item configuration:

    • :cmd => shell command

    • :symbol => character

    • :color => color name



15
16
17
18
19
# File 'lib/rprompt.rb', line 15

def initialize(config)
	@cmd        = config[:cmd]
	@symbol     = config[:symbol]
	@color      = config[:color]
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



9
10
11
# File 'lib/rprompt.rb', line 9

def color
  @color
end

#symbolObject (readonly)

Returns the value of attribute symbol.



9
10
11
# File 'lib/rprompt.rb', line 9

def symbol
  @symbol
end

Instance Method Details

#commandResultString

executes prompt item command

Returns:



23
24
25
# File 'lib/rprompt.rb', line 23

def commandResult
	%x(#{@cmd} 2> /dev/null)
end