Module: Elasticsearch::Model::Proxy::Base

Included in:
ClassMethodsProxy, InstanceMethodsProxy
Defined in:
lib/elasticsearch/model/proxy.rb

Overview

Common module for the proxy classes

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Delegate methods to ‘@target`



79
80
81
# File 'lib/elasticsearch/model/proxy.rb', line 79

def method_missing(method_name, *arguments, &block)
  target.respond_to?(method_name) ? target.__send__(method_name, *arguments, &block) : super
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



71
72
73
# File 'lib/elasticsearch/model/proxy.rb', line 71

def target
  @target
end

Instance Method Details

#initialize(target) ⇒ Object



73
74
75
# File 'lib/elasticsearch/model/proxy.rb', line 73

def initialize(target)
  @target = target
end

#inspectObject



89
90
91
# File 'lib/elasticsearch/model/proxy.rb', line 89

def inspect
  "[PROXY] #{target.inspect}"
end

#respond_to?(method_name, include_private = false) ⇒ Boolean

Respond to methods from ‘@target`

Returns:

  • (Boolean)


85
86
87
# File 'lib/elasticsearch/model/proxy.rb', line 85

def respond_to?(method_name, include_private = false)
  target.respond_to?(method_name) || super
end