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
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
chida_fib-0.1.0 shoulda/ruby/1.8/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.9 dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.9 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.9 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.8 dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.8 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.8 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.7 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.7 dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.7 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.6 dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.6 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.6 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.5 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.5 dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb
dirty_history-0.4.5 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/git-1.2.5/lib/git/stashes.rb