module RediSearch::Document::Display

Public Instance Methods

inspect() click to toggle source
# File lib/redi_search/document/display.rb, line 6
def inspect
  inspection = pretty_print_attributes.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/document/display.rb, line 23
def pretty_print(printer) # rubocop:disable Metrics/MethodLength
  printer.object_address_group(self) do
    printer.seplist(
      pretty_print_attributes , 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
pretty_print_attributes() click to toggle source
# File lib/redi_search/document/display.rb, line 14
def pretty_print_attributes
  pp_attrs = attributes.keys.dup
  pp_attrs.push("document_id")
  pp_attrs.push("score") if score

  pp_attrs.compact
end