summaryrefslogtreecommitdiffstats
path: root/lib/git/branches.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git/branches.rb')
-rw-r--r--lib/git/branches.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/git/branches.rb b/lib/git/branches.rb
index d664d59..81abe22 100644
--- a/lib/git/branches.rb
+++ b/lib/git/branches.rb
@@ -8,8 +8,36 @@ module Git
@branches = nil
def initialize(base)
+ @branches = {}
+
@base = base
- @branches = @base.lib.branches_all
+ @base.lib.branches_all.each do |b|
+ @branches[b.full] = b
+ 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
+ @branches.each do |k, b|
+ yield b
+ end
+ end
+
+ def [](symbol)
+ @branches[symbol.to_s]
end
end