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.
38 39 40 41 42 |
# File 'lib/git/stash.rb', line 38 def initialize(base, , existing: false) @base = base @message = save unless existing end |
Instance Attribute Details
#message ⇒ String (readonly)
Returns the stash description
80 81 82 |
# File 'lib/git/stash.rb', line 80 def @message end |
Instance Method Details
#save ⇒ Boolean
Saves the current working-directory state to the stash stack
55 56 57 |
# File 'lib/git/stash.rb', line 55 def save @saved = stash_repository.stash_save(@message) end |
#saved? ⇒ Boolean?
Returns whether the stash was saved successfully
68 69 70 |
# File 'lib/git/stash.rb', line 68 def saved? @saved end |
#to_s ⇒ String
Returns the stash description as a string
90 91 92 |
# File 'lib/git/stash.rb', line 90 def to_s end |