lib/fuzzy_match/result.rb in fuzzy_match-1.5.0 vs lib/fuzzy_match/result.rb in fuzzy_match-2.0.0
- old
+ new
@@ -1,30 +1,33 @@
+# encoding: utf-8
require 'erb'
+require 'pp'
class FuzzyMatch
class Result #:nodoc: all
EXPLANATION = <<-ERB
-You looked for <%= needle.render.inspect %>
+#####################################################
+# SUMMARY
+#####################################################
-<% if winner %>It was matched with "<%= winner %>"<% else %>No match was found<% end %>
+Needle: <%= needle.inspect %>
+Match: <%= winner.inspect %>
-# THE HAYSTACK
+#####################################################
+# OPTIONS
+#####################################################
-The haystack reader was <%= read.inspect %>.
+<%= PP.pp(options, '') %>
-The haystack contained <%= haystack.length %> records like <%= haystack[0, 3].map(&:render).map(&:inspect).join(', ') %>
-
-# HOW IT WAS MATCHED
<% timeline.each_with_index do |event, index| %>
(<%= index+1 %>) <%= event %>
<% end %>
ERB
attr_accessor :needle
attr_accessor :read
attr_accessor :haystack
attr_accessor :options
- attr_accessor :normalizers
attr_accessor :groupings
attr_accessor :identities
attr_accessor :stop_words
attr_accessor :winner
attr_accessor :score