Austin Ziegler
1/29/2005 12:34:00 AM
On Sat, 29 Jan 2005 07:29:59 +0900, Florian Frank <flori@nixe.ping.de> wrote:
> Bret Pettichord wrote:
>
> > how?
>
> foo.instance_eval do
> bar
> baz(1)
> bagaloo('didoo')
> end
Note that this won't work if you try to use assignment, because that
will be interpreted as a local variable. Better:
module Kernel
def with(obj)
yield self if block_given?
end
end
with longfooname do |f|
f.bar
f.baz(1)
f.bagaloo('didoo')
end
-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca