From: Dan Yoder Date: 2007-10-22T02:45:03+09:00 Subject: Re: "with" statement 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 On Oct 21, 8:15 am, Perry Smith wrote: > Pascal has a with statement. (I'm showing my age). It would be nice > instead of: > > <%= h relationship.parent_id %> > <%= h relationship.link_type.pcln %> > <%= h relationship.child_id %> > <%= h relationship.active %> > <%= h relationship.notes %> > <%= h relationship.created_at %> > <%= h relationship.updated_at %> > > I could do: > > with(relationship) { > <%= h parent_id %> > <%= h link_type.pcln %> > <%= h child_id %> > <%= h active %> > <%= h notes %> > <%= h created_at %> > <%= h updated_at %> > } > > I bet there is a clever way to do this -- I just don't know now. > -- > Posted viahttp://www.ruby-forum.com/.