Class: Git::GitConflict

Inherits:
Object
  • Object
show all
Defined in:
lib/git/git_conflict.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository_name, branch_a, branch_b, conflicting_files) ⇒ GitConflict

Returns a new instance of GitConflict.



7
8
9
10
11
12
13
14
15
16
# File 'lib/git/git_conflict.rb', line 7

def initialize(repository_name, branch_a, branch_b, conflicting_files)
  unless conflicting_files.present?
    raise ArgumentError, 'Must specify conflicting file list'
  end

  @repository_name = repository_name
  @branch_a = branch_a
  @branch_b = branch_b
  @conflicting_files = conflicting_files
end

Instance Attribute Details

#branch_aObject (readonly)

Returns the value of attribute branch_a.



5
6
7
# File 'lib/git/git_conflict.rb', line 5

def branch_a
  @branch_a
end

#branch_bObject (readonly)

Returns the value of attribute branch_b.



5
6
7
# File 'lib/git/git_conflict.rb', line 5

def branch_b
  @branch_b
end

#conflicting_filesObject (readonly)

Returns the value of attribute conflicting_files.



5
6
7
# File 'lib/git/git_conflict.rb', line 5

def conflicting_files
  @conflicting_files
end

#repository_nameObject (readonly)

Returns the value of attribute repository_name.



5
6
7
# File 'lib/git/git_conflict.rb', line 5

def repository_name
  @repository_name
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
22
23
# File 'lib/git/git_conflict.rb', line 18

def ==(other)
  repository_name == other.repository_name \
    && branch_a == other.branch_a \
    && branch_b == other.branch_b \
    && conflicting_files == other.conflicting_files
end

#contains_branch(branch_name) ⇒ Object



25
26
27
# File 'lib/git/git_conflict.rb', line 25

def contains_branch(branch_name)
  branch_a == branch_name || branch_b == branch_name
end