Class: HandleBranch

Inherits:
Struct
  • Object
show all
Defined in:
lib/handle-branch.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(branch) ⇒ HandleBranch

Returns a new instance of HandleBranch.



7
8
9
# File 'lib/handle-branch.rb', line 7

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/handle-branch.rb', line 1

def branch
  @branch
end

Class Method Details

.call(*args) ⇒ Object



3
4
5
# File 'lib/handle-branch.rb', line 3

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'lib/handle-branch.rb', line 11

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