Class: GitPrompt
- Inherits:
-
Object
- Object
- GitPrompt
- Defined in:
- lib/git_prompt.rb
Constant Summary collapse
- SELECT_OPTIONS_PER_PAGE =
10
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#git ⇒ Object
readonly
Returns the value of attribute git.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
-
#initialize(git: nil) ⇒ GitPrompt
constructor
A new instance of GitPrompt.
Constructor Details
#initialize(git: nil) ⇒ GitPrompt
Returns a new instance of GitPrompt.
14 15 16 17 18 19 20 21 22 |
# File 'lib/git_prompt.rb', line 14 def initialize(git: nil) @git = git || Git.open(Dir.pwd) @branch = Treeish::Branch.new(git: git) @tag = Treeish::Tag.new(git: git) create_prompt define_key_events display_select(:branch, branch.recents) end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
12 13 14 |
# File 'lib/git_prompt.rb', line 12 def branch @branch end |
#git ⇒ Object (readonly)
Returns the value of attribute git.
12 13 14 |
# File 'lib/git_prompt.rb', line 12 def git @git end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/git_prompt.rb', line 12 def logger @logger end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
12 13 14 |
# File 'lib/git_prompt.rb', line 12 def prompt @prompt end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
12 13 14 |
# File 'lib/git_prompt.rb', line 12 def tag @tag end |