Class: Git::Stashes
Overview
object that holds all the available stashes
Instance Method Summary collapse
- #[](index) ⇒ Object
- #apply(index = 0) ⇒ Object
- #clear ⇒ Object
- #each ⇒ Object
-
#initialize(base) ⇒ Stashes
constructor
A new instance of Stashes.
- #save(message) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(base) ⇒ Stashes
10 11 12 13 14 15 16 17 18 |
# File 'lib/git/stashes.rb', line 10 def initialize(base) @stashes = [] @base = base @base.lib.stashes_all.each do |id, | @stashes.unshift(Git::Stash.new(@base, , true)) end end |
Instance Method Details
#[](index) ⇒ Object
44 45 46 |
# File 'lib/git/stashes.rb', line 44 def [](index) @stashes[index.to_i] end |
#apply(index = 0) ⇒ Object
25 26 27 |
# File 'lib/git/stashes.rb', line 25 def apply(index=0) @base.lib.stash_apply(index.to_i) end |
#clear ⇒ Object
29 30 31 32 |
# File 'lib/git/stashes.rb', line 29 def clear @base.lib.stash_clear @stashes = [] end |
#each ⇒ Object
38 39 40 41 42 |
# File 'lib/git/stashes.rb', line 38 def each @stashes.each do |s| yield s end end |
#save(message) ⇒ Object
20 21 22 23 |
# File 'lib/git/stashes.rb', line 20 def save() s = Git::Stash.new(@base, ) @stashes.unshift(s) if s.saved? end |
#size ⇒ Object
34 35 36 |
# File 'lib/git/stashes.rb', line 34 def size @stashes.size end |