send -> __send__ #36

Closed
wants to merge 4 commits into from

5 participants

@k-yamada

in case that redefined send, the library should use the alias send.

@k-yamada k-yamada send -> __send__
in case that redefined send, the library should use the alias __send__.
8adadaf
@nappa

Oops, Object#__send__ should not be overridden!

With this change, Ruby interpreter will emit this:

warning: redefining `send' may cause serious problems

Didn't you see it?

thank you review.

It's my mistake. I returned to this code and re-commited.

But I could not find that warning message when build and test.

@nappa

any questions?

@nappa

But I could not find that warning message when build and test.

To get the warning message, just give -w option to ruby command.

@k-yamada

To get the warning message, just give -w option to ruby command.

Thanks!

@Empact Empact commented on the diff May 20, 2012
lib/net/ssh/proxy/command.rb
@@ -60,7 +60,7 @@ def open(host, port)
end
@command_line = command_line
class << io
- def send(data, flag)
+ def __send__(data, flag)
@Empact
Empact added a note May 20, 2012

__send__ shouldn't be overridden here either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@delano
Collaborator

What's the problem with overriding __send__?

@arturaz

__send__ is meant as a last resort method if someone overwrites #send,

It should always invoke methods on objects.

@delano delano closed this Nov 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment