|
1 |
| -require 'forwardable' |
2 |
| - |
3 | 1 | require 'elasticsearch'
|
4 | 2 |
|
5 | 3 | require 'hashie'
|
6 | 4 |
|
7 |
| -require 'elasticsearch/model/support/forwardable' |
| 5 | +require 'active_support/core_ext/module/delegation' |
8 | 6 |
|
9 | 7 | require 'elasticsearch/model/version'
|
10 | 8 |
|
@@ -105,14 +103,15 @@ def as_indexed_json(options={})
|
105 | 103 |
|
106 | 104 | # Delegate important methods to the `__elasticsearch__` proxy, unless they are defined already
|
107 | 105 | #
|
108 |
| - extend Support::Forwardable |
109 |
| - forward :'self.__elasticsearch__', :search unless respond_to?(:search) |
110 |
| - forward :'self.__elasticsearch__', :mapping unless respond_to?(:mapping) |
111 |
| - forward :'self.__elasticsearch__', :mappings unless respond_to?(:mappings) |
112 |
| - forward :'self.__elasticsearch__', :settings unless respond_to?(:settings) |
113 |
| - forward :'self.__elasticsearch__', :index_name unless respond_to?(:index_name) |
114 |
| - forward :'self.__elasticsearch__', :document_type unless respond_to?(:document_type) |
115 |
| - forward :'self.__elasticsearch__', :import unless respond_to?(:import) |
| 106 | + class << self |
| 107 | + delegate :search, to: :__elasticsearch__ unless respond_to?(:search) |
| 108 | + delegate :mapping, to: :__elasticsearch__ unless respond_to?(:mapping) |
| 109 | + delegate :mappings, to: :__elasticsearch__ unless respond_to?(:mappings) |
| 110 | + delegate :settings, to: :__elasticsearch__ unless respond_to?(:settings) |
| 111 | + delegate :index_name, to: :__elasticsearch__ unless respond_to?(:index_name) |
| 112 | + delegate :document_type, to: :__elasticsearch__ unless respond_to?(:document_type) |
| 113 | + delegate :import, to: :__elasticsearch__ unless respond_to?(:import) |
| 114 | + end |
116 | 115 |
|
117 | 116 | # Mix the importing module into the proxy
|
118 | 117 | #
|
|
0 commit comments