Class: Merge::Diff3::Conflict

Inherits:
Struct
  • Object
show all
Defined in:
lib/merge/diff3.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#a_linesObject

Returns the value of attribute a_lines

Returns:

  • (Object)

    the current value of a_lines



12
13
14
# File 'lib/merge/diff3.rb', line 12

def a_lines
  @a_lines
end

#b_linesObject

Returns the value of attribute b_lines

Returns:

  • (Object)

    the current value of b_lines



12
13
14
# File 'lib/merge/diff3.rb', line 12

def b_lines
  @b_lines
end

#o_linesObject

Returns the value of attribute o_lines

Returns:

  • (Object)

    the current value of o_lines



12
13
14
# File 'lib/merge/diff3.rb', line 12

def o_lines
  @o_lines
end

Instance Method Details

#separator(text, char, name = nil) ⇒ Object



23
24
25
26
27
# File 'lib/merge/diff3.rb', line 23

def separator(text, char, name = nil)
  text.concat(char * 7)
  text.concat(" #{ name }") if name
  text.concat("\n")
end

#to_s(a_name = nil, b_name = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/merge/diff3.rb', line 13

def to_s(a_name = nil, b_name = nil)
  text = ""
  separator(text, "<", a_name)
  a_lines.each { |line| text.concat(line) }
  separator(text, "=")
  b_lines.each { |line| text.concat(line) }
  separator(text, ">", b_name)
  text
end