class Git::Stashes

object that holds all the available stashes

Public Class Methods

new(base) click to toggle source
# File lib/git/stashes.rb, line 7
def initialize(base)
  @stashes = []
  
  @base = base
        
  @base.lib.stashes_all.each do |id, message|
    @stashes.unshift(Git::Stash.new(@base, message, true))
  end
end

Public Instance Methods

[](index) click to toggle source
# File lib/git/stashes.rb, line 50
def [](index)
  @stashes[index.to_i]
end
all() click to toggle source

Returns an multi-dimensional Array of elements that have been stash saved. Array is based on position and name. See Example

@example Returns Array of items that have been stashed

.all - [0, "testing-stash-all"]]

@return [Array]

# File lib/git/stashes.rb, line 24
def all
  @base.lib.stashes_all
end
apply(index=nil) click to toggle source
# File lib/git/stashes.rb, line 33
def apply(index=nil)
  @base.lib.stash_apply(index)
end
clear() click to toggle source
# File lib/git/stashes.rb, line 37
def clear
  @base.lib.stash_clear
  @stashes = []
end
each(&block) click to toggle source
# File lib/git/stashes.rb, line 46
def each(&block)
  @stashes.each(&block)
end
save(message) click to toggle source
# File lib/git/stashes.rb, line 28
def save(message)
  s = Git::Stash.new(@base, message)
  @stashes.unshift(s) if s.saved?
end
size() click to toggle source
# File lib/git/stashes.rb, line 42
def size
  @stashes.size
end