Re: "with" statement
by Perry Smith other posts by this author
Oct 21 2007 12:22PM messages near this date
Re: "with" statement
|
Re: "with" statement
Dan Yoder wrote:
> Robert and David are right - you can use instance_eval. If you really
> want with, it is very easy to add:
>
> module Kernel
> def with(object,&block)
> object.instance_eval &block
> end
> end
>
> with([1,2,3]) { length } # => 3
>
>
> ---
> Dan Yoder
> http://dev.zeraweb.com/
> Ruby And JavaScript Consulting
Yippie!!! I figured there was a way.
I think I also want for_with -- but I can do that (I hope).
Thank you to all...
--
Posted via http://www.ruby-forum.com/.
Thread:
Perry Smith
Dan Yoder
Pete Elmore
Randy Kramer
Giles Bowkett
Robert Klemme
Giles Bowkett
Stefan Rusterholz
Yossef Mendelssohn
Perry Smith
David A. Black
Robert Dober
Stephane Wirtel
|