Class: Git::Stashes
Overview
object that holds all the available stashes
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#all ⇒ Array
Returns an multi-dimensional Array of elements that have been stash saved.
- #apply(index = nil) ⇒ Object
- #clear ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(base) ⇒ Stashes
constructor
A new instance of Stashes.
- #save(message) ⇒ Object
- #size ⇒ Object
Constructor Details
Instance Method Details
#[](index) ⇒ Object
50 51 52 |
# File 'lib/git/stashes.rb', line 50 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
24 25 26 |
# File 'lib/git/stashes.rb', line 24 def all @base.lib.stashes_all end |
#apply(index = nil) ⇒ Object
33 34 35 |
# File 'lib/git/stashes.rb', line 33 def apply(index=nil) @base.lib.stash_apply(index) end |
#clear ⇒ Object
37 38 39 40 |
# File 'lib/git/stashes.rb', line 37 def clear @base.lib.stash_clear @stashes = [] end |
#each(&block) ⇒ Object
46 47 48 |
# File 'lib/git/stashes.rb', line 46 def each(&block) @stashes.each(&block) end |
#save(message) ⇒ Object
28 29 30 31 |
# File 'lib/git/stashes.rb', line 28 def save() s = Git::Stash.new(@base, ) @stashes.unshift(s) if s.saved? end |
#size ⇒ Object
42 43 44 |
# File 'lib/git/stashes.rb', line 42 def size @stashes.size end |