From: Pete Elmore <1337p337@...> Date: 2007-10-24T02:48:12+09:00 Subject: Re: "with" statement On 21/10/2007, Dan Yoder wrote: > module Kernel > def with(object,&block) > object.instance_eval &block > end > end > > with([1,2,3]) { length } # => 3 You could even do something like this: module Kernel def with_block(*args, &block) send(*args) { |obj| obj.instance_eval &block } end end ['asdf', 'jkl', 'semicolon'].with_block(:map) { length } # => [4, 3, 9] That would allow something like this: <% with_block(:form_for, :user, @user) { %> <%= text_field :name %> <%= text_field :email %> <%= password_field :password %> <% } %> It may or may not be useful, but it's fun.