Class: GitPrompt

Inherits:
Object
  • Object
show all
Defined in:
lib/git_prompt.rb

Constant Summary collapse

SELECT_OPTIONS_PER_PAGE =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#branchObject (readonly)

Returns the value of attribute branch.



12
13
14
# File 'lib/git_prompt.rb', line 12

def branch
  @branch
end

#gitObject (readonly)

Returns the value of attribute git.



12
13
14
# File 'lib/git_prompt.rb', line 12

def git
  @git
end

#loggerObject (readonly)

Returns the value of attribute logger.



12
13
14
# File 'lib/git_prompt.rb', line 12

def logger
  @logger
end

#promptObject (readonly)

Returns the value of attribute prompt.



12
13
14
# File 'lib/git_prompt.rb', line 12

def prompt
  @prompt
end

#tagObject (readonly)

Returns the value of attribute tag.



12
13
14
# File 'lib/git_prompt.rb', line 12

def tag
  @tag
end