File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
activesupport/lib/active_support Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -173,16 +173,18 @@ def current_instances_key
173
173
end
174
174
175
175
def method_missing ( name , ...)
176
- # Caches the method definition as a singleton method of the receiver.
177
- #
178
- # By letting #delegate handle it, we avoid an enclosure that'll capture args.
179
- singleton_class . delegate name , to : :instance
180
-
181
- send ( name , ...)
176
+ instance . public_send ( name , ...)
182
177
end
183
178
184
179
def respond_to_missing? ( name , _ )
185
- super || instance . respond_to? ( name )
180
+ instance . respond_to? ( name ) || super
181
+ end
182
+
183
+ def method_added ( name )
184
+ return if name == :initialize
185
+ return unless public_method_defined? ( name )
186
+ return if respond_to? ( name , true )
187
+ singleton_class . delegate ( name , to : :instance , as : self )
186
188
end
187
189
end
188
190
You can’t perform that action at this time.
0 commit comments