Class: Git::Stash
- Inherits:
-
Object
- Object
- Git::Stash
- Defined in:
- lib/git/stash.rb
Overview
Represents a single stash entry in a Git repository
Instance Attribute Summary collapse
-
#message ⇒ String
readonly
Returns the stash description.
Instance Method Summary collapse
-
#initialize(base, message, existing: false)
constructor
Initialize a Stash object.
-
#save ⇒ Boolean
Saves the current working-directory state to the stash stack.
-
#saved? ⇒ Boolean?
Returns whether the stash was saved successfully.
-
#to_s ⇒ String
Returns the stash description as a string.
Constructor Details
#initialize(base, message, existing: false)
Initialize a Stash object
When existing is false (the default), immediately calls #save to push
the current working-directory state onto the stash stack.
36 37 38 39 40 |
# File 'lib/git/stash.rb', line 36 def initialize(base, , existing: false) @base = base @message = save unless existing end |
Instance Attribute Details
#message ⇒ String (readonly)
Returns the stash description
78 79 80 |
# File 'lib/git/stash.rb', line 78 def @message end |
Instance Method Details
#save ⇒ Boolean
Saves the current working-directory state to the stash stack
53 54 55 |
# File 'lib/git/stash.rb', line 53 def save @saved = stash_repository.stash_save(@message) end |
#saved? ⇒ Boolean?
Returns whether the stash was saved successfully
66 67 68 |
# File 'lib/git/stash.rb', line 66 def saved? @saved end |
#to_s ⇒ String
Returns the stash description as a string
88 89 90 |
# File 'lib/git/stash.rb', line 88 def to_s end |