psych
psych copied to clipboard
Kernel.y interferes with code relying on method_missing
Good day,
I have coordinate objects in protobuf which have a .y
attribute defined, but rely on method_missing
to trigger calls to C.
Kernel.y intercepts the message and gives me an unexpected result.
I believe other systems which also rely on method_missing like nokogiri will cause the same trouble when trying to access an arbitrary "y" property in a document.
Can we rename the "y" patch to Kernel, to something less common, please? https://github.com/ruby/psych/blob/21f051bd1ae36809449406ad2a735c295b2c31ba/lib/psych/y.rb#L5
Otherwise people who use x,y,z coordinates get adverse effects and have to implement a workaround like the following.
def y
send(:method_missing, :y)
end
Even "yy" would be better. Thank you :)