Class: Object

Inherits:
BasicObject
Defined in:
lib/contrast_with.rb

Instance Method Summary collapse

Instance Method Details

#contrast_with(other, fields) ⇒ Object



2
3
4
5
# File 'lib/contrast_with.rb', line 2

def contrast_with(other, fields)
  detective = Contrast::Detective.new(*fields)
  detective.examine(self, other)
end

#contrast_with!(other, fields) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/contrast_with.rb', line 7

def contrast_with!(other, fields)
  results = self.contrast_with(other, fields)
  if results.any?
    exception = Contrast::MatchingException.new
    exception.results = results
    raise exception
  end
end