Class: Git::Stashes
Overview
object that holds all the available stashes
Instance Method Summary collapse
- #[](index)
-
#all ⇒ Array
Returns an multi-dimensional Array of elements that have been stash saved.
- #apply(index = nil)
- #clear
- #each
-
#initialize(base) ⇒ Stashes
constructor
A new instance of Stashes.
- #save(message)
- #size
Constructor Details
Instance Method Details
#[](index)
52 53 54 |
# File 'lib/git/stashes.rb', line 52 def [](index) @stashes[index.to_i] end |
#all ⇒ Array
Returns an multi-dimensional Array of elements that have been stash saved. Array is based on position and name. See Example
26 27 28 |
# File 'lib/git/stashes.rb', line 26 def all @base.lib.stashes_all end |
#apply(index = nil)
35 36 37 |
# File 'lib/git/stashes.rb', line 35 def apply(index = nil) @base.lib.stash_apply(index) end |
#clear
39 40 41 42 |
# File 'lib/git/stashes.rb', line 39 def clear @base.lib.stash_clear @stashes = [] end |
#each
48 49 50 |
# File 'lib/git/stashes.rb', line 48 def each(&) @stashes.each(&) end |
#save(message)
30 31 32 33 |
# File 'lib/git/stashes.rb', line 30 def save() s = Git::Stash.new(@base, ) @stashes.unshift(s) if s.saved? end |
#size
44 45 46 |
# File 'lib/git/stashes.rb', line 44 def size @stashes.size end |