Class: Archimate::Diff::Conflict

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/diff/conflict.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_local_diffs, base_remote_diffs, reason) ⇒ Conflict

Returns a new instance of Conflict.



10
11
12
13
14
15
# File 'lib/archimate/diff/conflict.rb', line 10

def initialize(base_local_diffs, base_remote_diffs, reason)
  @base_local_diffs = Array(base_local_diffs)
  @base_remote_diffs = Array(base_remote_diffs)
  @diffs = @base_local_diffs + @base_remote_diffs
  @reason = reason
end

Instance Attribute Details

#base_local_diffsObject (readonly)

Returns the value of attribute base_local_diffs.



5
6
7
# File 'lib/archimate/diff/conflict.rb', line 5

def base_local_diffs
  @base_local_diffs
end

#base_remote_diffsObject (readonly)

Returns the value of attribute base_remote_diffs.



6
7
8
# File 'lib/archimate/diff/conflict.rb', line 6

def base_remote_diffs
  @base_remote_diffs
end

#diffsObject (readonly)

Returns the value of attribute diffs.



8
9
10
# File 'lib/archimate/diff/conflict.rb', line 8

def diffs
  @diffs
end

#reasonObject (readonly)

Returns the value of attribute reason.



7
8
9
# File 'lib/archimate/diff/conflict.rb', line 7

def reason
  @reason
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
26
27
28
# File 'lib/archimate/diff/conflict.rb', line 23

def ==(other)
  other.is_a?(self.class) &&
    base_local_diffs == other.base_local_diffs &&
    base_remote_diffs == other.base_remote_diffs &&
    reason == other.reason
end

#to_sObject



17
18
19
20
21
# File 'lib/archimate/diff/conflict.rb', line 17

def to_s
  "#{Color.color('CONFLICT:', [:black, :on_red])} #{reason}\n" \
    "\tBase->Local Diff(s):\n\t\t#{base_local_diffs.map(&:to_s).join("\n\t\t")}" \
    "\n\tBase->Remote Diffs(s):\n\t\t#{base_remote_diffs.map(&:to_s).join("\n\t\t")}"
end