Class: FuzzyMatch::Result
- Inherits:
-
Object
- Object
- FuzzyMatch::Result
- Defined in:
- lib/fuzzy_match/result.rb
Overview
:nodoc: all
Constant Summary collapse
- EXPLANATION =
<<-ERB You looked for <%= needle.render.inspect %> <% if winner %>It was matched with "<%= winner %>"<% else %>No match was found<% end %> # THE HAYSTACK The haystack reader was <%= read.inspect %>. 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
Instance Attribute Summary collapse
-
#groupings ⇒ Object
Returns the value of attribute groupings.
-
#haystack ⇒ Object
Returns the value of attribute haystack.
-
#identities ⇒ Object
Returns the value of attribute identities.
-
#needle ⇒ Object
Returns the value of attribute needle.
-
#normalizers ⇒ Object
Returns the value of attribute normalizers.
-
#options ⇒ Object
Returns the value of attribute options.
-
#read ⇒ Object
Returns the value of attribute read.
-
#score ⇒ Object
Returns the value of attribute score.
-
#stop_words ⇒ Object
Returns the value of attribute stop_words.
-
#timeline ⇒ Object
readonly
Returns the value of attribute timeline.
-
#winner ⇒ Object
Returns the value of attribute winner.
Instance Method Summary collapse
- #explain ⇒ Object
-
#initialize ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
34 35 36 |
# File 'lib/fuzzy_match/result.rb', line 34 def initialize @timeline = [] end |
Instance Attribute Details
#groupings ⇒ Object
Returns the value of attribute groupings.
27 28 29 |
# File 'lib/fuzzy_match/result.rb', line 27 def groupings @groupings end |
#haystack ⇒ Object
Returns the value of attribute haystack.
24 25 26 |
# File 'lib/fuzzy_match/result.rb', line 24 def haystack @haystack end |
#identities ⇒ Object
Returns the value of attribute identities.
28 29 30 |
# File 'lib/fuzzy_match/result.rb', line 28 def identities @identities end |
#needle ⇒ Object
Returns the value of attribute needle.
22 23 24 |
# File 'lib/fuzzy_match/result.rb', line 22 def needle @needle end |
#normalizers ⇒ Object
Returns the value of attribute normalizers.
26 27 28 |
# File 'lib/fuzzy_match/result.rb', line 26 def normalizers @normalizers end |
#options ⇒ Object
Returns the value of attribute options.
25 26 27 |
# File 'lib/fuzzy_match/result.rb', line 25 def @options end |
#read ⇒ Object
Returns the value of attribute read.
23 24 25 |
# File 'lib/fuzzy_match/result.rb', line 23 def read @read end |
#score ⇒ Object
Returns the value of attribute score.
31 32 33 |
# File 'lib/fuzzy_match/result.rb', line 31 def score @score end |
#stop_words ⇒ Object
Returns the value of attribute stop_words.
29 30 31 |
# File 'lib/fuzzy_match/result.rb', line 29 def stop_words @stop_words end |
#timeline ⇒ Object (readonly)
Returns the value of attribute timeline.
32 33 34 |
# File 'lib/fuzzy_match/result.rb', line 32 def timeline @timeline end |
#winner ⇒ Object
Returns the value of attribute winner.
30 31 32 |
# File 'lib/fuzzy_match/result.rb', line 30 def winner @winner end |
Instance Method Details
#explain ⇒ Object
38 39 40 |
# File 'lib/fuzzy_match/result.rb', line 38 def explain $stdout.puts ::ERB.new(EXPLANATION, 0, '%<').result(binding) end |