From: Francis Hwang Date: 2005-11-02T13:47:08+09:00 Subject: Re: urirequire: I got yer Web 2.0 right here Jeff Wood wrote: > lib ??? > > shouldn't that be like 4 lines??? > > def net_eval( url ) > require 'open-uri' > eval open( url ).readlines.join > end Yeah, something like that. Actually right now urirequire clocks in at 23 lines, because of certain edge cases, and the fact that it uses Kernel.require, not a new method. Of course, the utility and elegance of such an override is quite debatable. At any rate, it's definitely quite small. Sometimes I package small seeds of functionality into libs, because Rubygems makes managing tiny libs easy, and because copy-and-paste makes the baby Jesus cry. > > ???!??!?!? ( or something similar to that ) ... and yeah, it takes real guts > to run code you don't own. > > BTW, your test URL ... is 404. Remember that when you require open-uri the file isn't actually "open-uri" -- it usually ends with an ".rb". Apply this analogously to a URI, and you'll get around that little 404 hurdle. f.