class RediSearch::Spellcheck::Result

Attributes

suggestions[R]
term[R]

Public Class Methods

new(term, suggestions) click to toggle source
# File lib/redi_search/spellcheck/result.rb, line 10
def initialize(term, suggestions)
  @term = term
  @suggestions = suggestions.map do |suggestion|
    Suggestion.new(suggestion[0].to_f, suggestion[1])
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/redi_search/spellcheck/result.rb, line 17
def inspect
  inspection = %w(term suggestions).map do |field_name|
    "#{field_name}: #{public_send(field_name)}"
  end.compact.join(", ")

  "#<#{self.class} #{inspection}>"
end
pretty_print(printer) click to toggle source

:nocov:

# File lib/redi_search/spellcheck/result.rb, line 26
def pretty_print(printer) # rubocop:disable Metrics/MethodLength
  printer.object_address_group(self) do
    printer.seplist(
      %w(term suggestions), proc { printer.text "," }
    ) do |field_name|
      printer.breakable " "
      printer.group(1) do
        printer.text field_name
        printer.text ":"
        printer.breakable
        printer.pp public_send(field_name)
      end
    end
  end
end