natalie
natalie copied to clipboard
Implement respond_to_missing and method missing
These 2 methods allow a subclass of Object to dynamically provide methods when respond_to does not. It is a useful mechanism for dynamic delegation and is used throughout the core library, including Array which needs it for flatten and flatten! (among other methods) #75 .
An example of these two methods can be found here. Links: respond_to_missing (part of Kernel):
- Docs: https://ruby-doc.org/core-3.0.2/Object.html#method-i-respond_to_missing-3F
- Spec: https://github.com/ruby/spec/blob/master/core/kernel/respond_to_missing_spec.rb
~method_missing (part of Object):~
- ~Docs: https://ruby-doc.org/core-3.0.2/Object.html#method-i-method_missing~
- ~Spec: https://github.com/ruby/spec/blob/master/core/basicobject/method_missing_spec.rb~
method_missing
was implemented in d2a45f275b9948826787b69a1b2d98b812bdae0b :tada:
We still need respond_to_missing?
though...