Class: Elasticity::Search::DocumentProxy

Inherits:
BasicObject
Defined in:
lib/elasticity/search.rb

Instance Method Summary collapse

Constructor Details

#initialize(search, document_klass) ⇒ DocumentProxy

Returns a new instance of DocumentProxy.



274
275
276
277
# File 'lib/elasticity/search.rb', line 274

def initialize(search, document_klass)
  @search         = search
  @document_klass = document_klass
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



289
290
291
# File 'lib/elasticity/search.rb', line 289

def method_missing(method_name, *args, &block)
  documents.public_send(method_name, *args, &block)
end

Instance Method Details

#documents(search_args = {}) ⇒ Object



281
282
283
# File 'lib/elasticity/search.rb', line 281

def documents(search_args = {})
  @search.documents(@document_klass, search_args)
end

#scan_documents(**options) ⇒ Object



285
286
287
# File 'lib/elasticity/search.rb', line 285

def scan_documents(**options)
  @search.scan_documents(@document_klass, **options)
end