Class: StructureConflictResolver::MergeConflict
- Inherits:
-
Object
- Object
- StructureConflictResolver::MergeConflict
- 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
-
#current_line ⇒ Object
Returns the value of attribute current_line.
-
#head_branch_blob ⇒ Object
Returns the value of attribute head_branch_blob.
-
#original_blob ⇒ Object
Returns the value of attribute original_blob.
-
#our_commit_blob ⇒ Object
Returns the value of attribute our_commit_blob.
Instance Method Summary collapse
-
#initialize ⇒ MergeConflict
constructor
A new instance of MergeConflict.
- #parse!(line) ⇒ Object
- #parse_error? ⇒ Boolean
- #resolvable? ⇒ Boolean
- #resolved_text ⇒ Object
Constructor Details
#initialize ⇒ MergeConflict
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_line ⇒ Object
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_blob ⇒ Object
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_blob ⇒ Object
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_blob ⇒ Object
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
47 48 49 |
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 47 def parse_error? !not_detected? && !scanning_completed? end |
#resolvable? ⇒ Boolean
51 52 53 |
# File 'lib/structure_conflict_resolver/merge_conflict.rb', line 51 def resolvable? !resolved_text.nil? end |
#resolved_text ⇒ Object
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 |