raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] middleware/proxy: favor __send__ for method dispatch
@ 2012-06-07 21:55 Eric Wong
  2012-06-08 18:11 ` Ben Somers
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2012-06-07 21:55 UTC (permalink / raw)
  To: raindrops

"send" is more likely to be overridden in subclasses whereas
the Ruby runtime (at least 1.9.3) will warn loudly if any user
code (re)defines the "__send__" method.

For example, BasicSocket#send and UDPSocket#send in the Ruby
stdlib are wrappers for the send(2)/sendto(2) system calls,
and it's entirely possible an application could return a
Socket-subclass as a Rack response body.
---
 Pushed to "master" of git://bogomips.org/raindrops

 lib/raindrops/middleware/proxy.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/raindrops/middleware/proxy.rb b/lib/raindrops/middleware/proxy.rb
index ce634bb..1cf437c 100644
--- a/lib/raindrops/middleware/proxy.rb
+++ b/lib/raindrops/middleware/proxy.rb
@@ -35,6 +35,6 @@ class Raindrops::Middleware::Proxy
   # Avoid breaking users of non-standard extensions (e.g. #body)
   # Rack::BodyProxy does the same.
   def method_missing(*args, &block)
-    @body.send(*args, &block)
+    @body.__send__(*args, &block)
   end
 end
-- 
1.7.11.rc0.55.gb2478aa


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] middleware/proxy: favor __send__ for method dispatch
  2012-06-07 21:55 [PATCH] middleware/proxy: favor __send__ for method dispatch Eric Wong
@ 2012-06-08 18:11 ` Ben Somers
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Somers @ 2012-06-08 18:11 UTC (permalink / raw)
  To: raindrops

> "send" is more likely to be overridden in subclasses whereas
> the Ruby runtime (at least 1.9.3) will warn loudly if any user
> code (re)defines the "__send__" method.

This seems eminently sensible and IIRC is the same way Rack does it.
Not sure why I changed it when making the original commit, I would
suspect my own foolishness.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-08 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 21:55 [PATCH] middleware/proxy: favor __send__ for method dispatch Eric Wong
2012-06-08 18:11 ` Ben Somers

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/raindrops.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).