Sha256: 8f34e4bd1cb21ee1f2cb1602a02c2fdffd38a905c99f2b2ebe899ed6adf8a666
Contents?: true
Size: 803 Bytes
Versions: 135
Compression:
Stored size: 803 Bytes
Contents
module Git # object that holds all the available branches class Branches include Enumerable def initialize(base) @branches = {} @base = base @base.lib.branches_all.each do |b| @branches[b[0]] = Git::Branch.new(@base, b[0]) end end def local self.select { |b| !b.remote } end def remote self.select { |b| b.remote } end # array like methods def size @branches.size end def each(&block) @branches.values.each(&block) end def [](symbol) @branches[symbol.to_s] end def to_s out = '' @branches.each do |k, b| out << (b.current ? '* ' : ' ') << b.to_s << "\n" end out end end end
Version data entries
135 entries across 108 versions & 16 rubygems