Class: StructureConflictResolver::MergeConflict

Inherits:
Object
  • Object
show all
Includes:
AASM
Defined in:
lib/structure_conflict_resolver/merge_conflict.rb

Constant Summary collapse

CONFLICT_A =
/^\<{7} (.*)$/
DIVIDER =
/^\={7}$/
CONFLICT_B =
/^\>{7} (.+)$/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMergeConflict

Returns a new instance of MergeConflict.



13
14
15
16
17
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 13

def initialize
  @original_blob    = String.new
  @head_branch_blob = String.new
  @our_commit_blob  = String.new
end

Instance Attribute Details

#current_lineObject

Returns the value of attribute current_line.



11
12
13
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 11

def current_line
  @current_line
end

#head_branch_blobObject

Returns the value of attribute head_branch_blob.



11
12
13
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 11

def head_branch_blob
  @head_branch_blob
end

#original_blobObject

Returns the value of attribute original_blob.



11
12
13
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 11

def original_blob
  @original_blob
end

#our_commit_blobObject

Returns the value of attribute our_commit_blob.



11
12
13
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 11

def our_commit_blob
  @our_commit_blob
end

Instance Method Details

#parse!(line) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 38

def parse!(line)
  @current_line = line
  enter_head_blob   if may_enter_head_blob?
  enter_our_blob    if may_enter_our_blob?
  complete_scanning if may_complete_scanning?

  store_lines!
end

#parse_error?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 47

def parse_error?
  !not_detected? && !scanning_completed?
end

#resolvable?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 51

def resolvable?
  !resolved_text.nil?
end

#resolved_textObject



55
56
57
58
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 55

def resolved_text
  @resolved_text ||= StructureType.from(head_branch_blob + our_commit_blob).resolved
rescue
end