Class: FuzzyMatch::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/fuzzy_match/result.rb

Overview

:nodoc: all

Constant Summary collapse

EXPLANATION =
<<-ERB
#####################################################
# SUMMARY
#####################################################

Needle: <%= needle.inspect %>
Match:  <%= winner.inspect %>

#####################################################
# OPTIONS
#####################################################

<%= PP.pp(options, '') %>

<% timeline.each_with_index do |event, index| %>
(<%= index+1 %>) <%= event %>
<% end %>
ERB

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



37
38
39
# File 'lib/fuzzy_match/result.rb', line 37

def initialize
  @timeline = []
end

Instance Attribute Details

#groupingsObject

Returns the value of attribute groupings.



30
31
32
# File 'lib/fuzzy_match/result.rb', line 30

def groupings
  @groupings
end

#haystackObject

Returns the value of attribute haystack.



28
29
30
# File 'lib/fuzzy_match/result.rb', line 28

def haystack
  @haystack
end

#identitiesObject

Returns the value of attribute identities.



31
32
33
# File 'lib/fuzzy_match/result.rb', line 31

def identities
  @identities
end

#needleObject

Returns the value of attribute needle.



26
27
28
# File 'lib/fuzzy_match/result.rb', line 26

def needle
  @needle
end

#optionsObject

Returns the value of attribute options.



29
30
31
# File 'lib/fuzzy_match/result.rb', line 29

def options
  @options
end

#readObject

Returns the value of attribute read.



27
28
29
# File 'lib/fuzzy_match/result.rb', line 27

def read
  @read
end

#scoreObject

Returns the value of attribute score.



34
35
36
# File 'lib/fuzzy_match/result.rb', line 34

def score
  @score
end

#stop_wordsObject

Returns the value of attribute stop_words.



32
33
34
# File 'lib/fuzzy_match/result.rb', line 32

def stop_words
  @stop_words
end

#timelineObject (readonly)

Returns the value of attribute timeline.



35
36
37
# File 'lib/fuzzy_match/result.rb', line 35

def timeline
  @timeline
end

#winnerObject

Returns the value of attribute winner.



33
34
35
# File 'lib/fuzzy_match/result.rb', line 33

def winner
  @winner
end

Instance Method Details

#explainObject



41
42
43
# File 'lib/fuzzy_match/result.rb', line 41

def explain
  $stdout.puts ::ERB.new(EXPLANATION, 0, '%<').result(binding)
end