Class: Sunspot::Search::Spellcheck
- Inherits:
-
Object
- Object
- Sunspot::Search::Spellcheck
- Defined in:
- lib/sunspot_suggest/sunspot/search/abstract_search.rb
Defined Under Namespace
Classes: Collation, Suggestion, Suggestions
Instance Attribute Summary collapse
-
#collations ⇒ Object
readonly
Returns the value of attribute collations.
-
#correctly_spelled ⇒ Object
writeonly
Sets the attribute correctly_spelled.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
Instance Method Summary collapse
- #add_collation(collation_values) ⇒ Object
- #add_suggestion(word, suggest_values) ⇒ Object
- #correctly_spelled? ⇒ Boolean
-
#initialize ⇒ Spellcheck
constructor
A new instance of Spellcheck.
Constructor Details
#initialize ⇒ Spellcheck
Returns a new instance of Spellcheck.
62 63 64 65 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 62 def initialize @suggestions = [] @collations = [] end |
Instance Attribute Details
#collations ⇒ Object (readonly)
Returns the value of attribute collations.
59 60 61 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 59 def collations @collations end |
#correctly_spelled=(value) ⇒ Object (writeonly)
Sets the attribute correctly_spelled
60 61 62 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 60 def correctly_spelled=(value) @correctly_spelled = value end |
#suggestions ⇒ Object (readonly)
Returns the value of attribute suggestions.
59 60 61 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 59 def suggestions @suggestions end |
Instance Method Details
#add_collation(collation_values) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 71 def add_collation(collation_values) if collation_values.is_a?(Array) @collations << Collation.new(Hash[*collation_values]) else raise ArgumentError, "Don't know how to handle collation: #{collation_values}" end end |
#add_suggestion(word, suggest_values) ⇒ Object
79 80 81 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 79 def add_suggestion(word, suggest_values) @suggestions << Suggestions.new(word, suggest_values) end |
#correctly_spelled? ⇒ Boolean
67 68 69 |
# File 'lib/sunspot_suggest/sunspot/search/abstract_search.rb', line 67 def correctly_spelled? @correctly_spelled end |