object that holds all the available branches
# File lib/git/branches.rb, line 7 def initialize(base) @branches = {} @base = base @base.lib.branches_all.each do |b| @branches[b[0]] = Git::Branch.new(@base, b[0]) end end
# File lib/git/branches.rb, line 35 def [](symbol) @branches[symbol.to_s] end
# File lib/git/branches.rb, line 31 def each(&block) @branches.values.each(&block) end
# File lib/git/branches.rb, line 17 def local self.select { |b| !b.remote } end
# File lib/git/branches.rb, line 21 def remote self.select { |b| b.remote } end
array like methods
# File lib/git/branches.rb, line 27 def size @branches.size end
# File lib/git/branches.rb, line 39 def to_s out = '' @branches.each do |k, b| out << (b.current ? '* ' : ' ') << b.to_s << "\n" end out end