From: Florian Gross Date: 2005-03-22T22:04:55+09:00 Subject: Re: [ANN] Ruby Facets 0.6.2 Daniel Amelang wrote: >>with("foo") { reverse } # "oof" > > Perhaps I'm confused with your example because it's contrived (on > purpose, I know), but the above makes little sense. It's just a long > way of saying 'foo.reverse'. Or did you mean to use 'reverse!' > > This is the way I understood how 'with' would work: > > s = "hello" > with(s) { > reverse! > capitalize! > } > p s # Olleh > > I'm actually not a big fan of the 'with' idea, or the Object.new {} > one, but I really like 'count'. Could have used it several times the > past couple months. I decided to return the last value of the block as that works in both cases. Just add a self: with(s) { reverse! capitalize! self }