Sha256: fa288fa447e259d15730b77a4b82ce5e485e3ed3241a4d1ef4a6cc4b0c877f7c

Contents?: true

Size: 760 Bytes

Versions: 160

Compression:

Stored size: 760 Bytes

Contents

module Git
  
  # object that holds all the available stashes
  class Stashes
    include Enumerable
    
    def initialize(base)
      @stashes = []
      
      @base = base
            
      @base.lib.stashes_all.each do |id, message|
        @stashes.unshift(Git::Stash.new(@base, message, true))
      end
    end
    
    def save(message)
      s = Git::Stash.new(@base, message)
      @stashes.unshift(s) if s.saved?
    end
    
    def apply(index=nil)
      @base.lib.stash_apply(index)
    end
    
    def clear
      @base.lib.stash_clear
      @stashes = []
    end

    def size
      @stashes.size
    end
    
    def each(&block)
      @stashes.each(&block)
    end
    
    def [](index)
      @stashes[index.to_i]
    end
    
  end
end

Version data entries

160 entries across 133 versions & 24 rubygems

Version Path
git-1.4.0 lib/git/stashes.rb
ruby-git-fw-new-1.3.3 lib/git/stashes.rb
ruby-git-yz-1.3.3 lib/git/stashes.rb
git-ng-1.4.0 lib/git/stashes.rb
cvss-suite-1.0.8 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
ruby-git-fw-1.3.2 lib/git/stashes.rb
ruby-git-fw-1.3.1 lib/git/stashes.rb
ruby-git-fw-1.3.0 lib/git/stashes.rb
cvss-suite-1.0.7 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.6 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.5 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.4 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.3 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.2 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.1 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
cvss-suite-1.0.0 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/stashes.rb
git-1.3.0 lib/git/stashes.rb
git-1.2.9.1 lib/git/stashes.rb
git-1.2.9 lib/git/stashes.rb
clc-git-1.2.8 lib/git/stashes.rb