class SearchKit::Models::Document

Public Class Methods

new(document_data = {}) click to toggle source
Calls superclass method
# File lib/search_kit/models/document.rb, line 12
def initialize(document_data = {})
  super(
    source: document_data.fetch(:source, {}),
    id:     document_data.fetch(:id, nil),
    score:  document_data.fetch(:score, nil)
  )
end

Public Instance Methods

get(field) click to toggle source
# File lib/search_kit/models/document.rb, line 20
def get(field)
  source.fetch(field.to_sym)
rescue KeyError
  fail AttributeNotFound, field
end
method_missing(method_name, *arguments, &block) click to toggle source
Calls superclass method
# File lib/search_kit/models/document.rb, line 30
def method_missing(method_name, *arguments, &block)
  get(method_name)
rescue AttributeNotFound
  super(method_name, *arguments, &block)
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/search_kit/models/document.rb, line 26
def respond_to_missing?(method_name, include_private = false)
  source.has_key?(method_name) || super(method_name, include_private)
end