Class: Matcher::TextFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/matcher/text_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(matcher) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/matcher/text_formatter.rb', line 5

def format(matcher)
  if matcher.mismatches.empty?
    puts "Documents matched"
  else
    puts "Documents didn't match:"
    puts matcher.mismatches.to_a.join(' : ')
    puts 
    matcher.lhs.traverse do |e|
      print e.path
      mismatch = matcher.mismatches[e.path]
      if mismatch
        puts " <====== #{mismatch}"
      else
        puts
      end
    end
  end
end