I am trying to create a proxy object that transfers almost all method calls to a child object, mainly to a delegation template. For the most part, I just use BasicObject and pass each call with the method_missing method to the child object. So far so good.
The trick is that I try, I cannot fool the case Ruby operator, so I cannot:
x = Proxy.new(15)
Fixnum === x #=> false, no matter what I do
This, of course, leads to the failure of any operations case x, which means that proxies cannot be safely transferred to other libraries.
I can’t understand for my whole life that it uses ===. The proxy server works fine for the entire introspection based on the class that I know, which is correctly passed to the child:
x.is_a?(Fixnum)
x.instance_of?(Fixnum)
x.kind_of?(Fixnum)
x.class
Module#=== , ?