class Git::Branches

object that holds all the available branches

Public Class Methods

new(base) click to toggle source
# 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

Public Instance Methods

[](symbol) click to toggle source
# File lib/git/branches.rb, line 35
def [](symbol)
  @branches[symbol.to_s]
end
each(&block) click to toggle source
# File lib/git/branches.rb, line 31
def each(&block)
  @branches.values.each(&block)
end
local() click to toggle source
# File lib/git/branches.rb, line 17
def local
  self.select { |b| !b.remote }
end
remote() click to toggle source
# File lib/git/branches.rb, line 21
def remote
  self.select { |b| b.remote }
end
size() click to toggle source

array like methods

# File lib/git/branches.rb, line 27
def size
  @branches.size
end
to_s() click to toggle source
# 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