Class: Elasticsearch::Model::Proxy::InstanceMethodsProxy

Inherits:
Object
  • Object
show all
Includes:
Client::InstanceMethods, Indexing::InstanceMethods, Naming::InstanceMethods, Base, Serializing::InstanceMethods
Defined in:
lib/elasticsearch/model/proxy.rb

Overview

A proxy interfacing between Elasticsearch::Model instance methods and model instance methods

TODO: Inherit from BasicObject and make Pry’s ‘ls` command behave?

Instance Attribute Summary

Attributes included from Base

#target

Instance Method Summary collapse

Methods included from Indexing::InstanceMethods

#delete_document, included, #index_document, #update_document, #update_document_attributes

Methods included from Naming::InstanceMethods

#document_type, #document_type=, #index_name, #index_name=

Methods included from Client::InstanceMethods

#client, #client=

Methods included from Base

#initialize, #inspect, #method_missing, #respond_to?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Elasticsearch::Model::Proxy::Base

Instance Method Details

#as_indexed_json(options = {}) ⇒ Object



174
175
176
# File 'lib/elasticsearch/model/proxy.rb', line 174

def as_indexed_json(options={})
  target.respond_to?(:as_indexed_json) ? target.__send__(:as_indexed_json, options) : super
end

#as_json(options = {}) ⇒ Object

Need to redefine ‘as_json` because we’re not inheriting from ‘BasicObject`; see TODO note above.



170
171
172
# File 'lib/elasticsearch/model/proxy.rb', line 170

def as_json(options={})
  target.as_json(options)
end

#classObject



163
164
165
# File 'lib/elasticsearch/model/proxy.rb', line 163

def class
  klass.__elasticsearch__
end

#klassObject



159
160
161
# File 'lib/elasticsearch/model/proxy.rb', line 159

def klass
  target.class
end