Class: HandleBranch

Inherits:
Struct
  • Object
show all
Defined in:
lib/git-pcheckout/handle_branch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(branch) ⇒ HandleBranch

Returns a new instance of HandleBranch.



3
4
5
# File 'lib/git-pcheckout/handle_branch.rb', line 3

def initialize(branch)
  self.branch = branch
end

Instance Attribute Details

#branchObject

Returns the value of attribute branch

Returns:

  • (Object)

    the current value of branch



1
2
3
# File 'lib/git-pcheckout/handle_branch.rb', line 1

def branch
  @branch
end

Instance Method Details

#performObject



7
8
9
10
11
12
13
# File 'lib/git-pcheckout/handle_branch.rb', line 7

def perform
  if branch_exists_locally?
    checkout_local_branch && pull_from_origin
  else
    fetch_from_origin && checkout_and_track_branch
  end
end