Class: Git::Branches
Overview
object that holds all the available branches
Instance Method Summary collapse
- #[](symbol) ⇒ Object
- #each ⇒ Object
-
#initialize(base) ⇒ Branches
constructor
A new instance of Branches.
- #local ⇒ Object
- #remote ⇒ Object
-
#size ⇒ Object
array like methods.
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#[](symbol) ⇒ Object
40 41 42 |
# File 'lib/git/branches.rb', line 40 def [](symbol) @branches[symbol.to_s] end |
#each ⇒ Object
34 35 36 37 38 |
# File 'lib/git/branches.rb', line 34 def each @branches.each do |k, b| yield b end end |
#local ⇒ Object
20 21 22 |
# File 'lib/git/branches.rb', line 20 def local self.select { |b| !b.remote } end |
#remote ⇒ Object
24 25 26 |
# File 'lib/git/branches.rb', line 24 def remote self.select { |b| b.remote } end |
#size ⇒ Object
array like methods
30 31 32 |
# File 'lib/git/branches.rb', line 30 def size @branches.size end |
#to_s ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/git/branches.rb', line 44 def to_s out = '' @branches.each do |k, b| if b.current out += "* " + b.to_s + "\n" else out += " " + b.to_s + "\n" end end out end |