From: "Ivan V." Date: 2008-04-26T03:43:03+09:00 Subject: How to return more than one object to a block Hi, I'm kinda new to blocks, and I'm trying to create my own Rails form builder, which I want to work like this: form_for ... do |f| f.form_label 'Some label' do f.text_field :something link_to 'somewhere', somewhere_path end end In my form_label method I capture the block output and wrap some HTML around it, but the problem is that the block only captures the last statement, in this case, the link_to. Here's a more clean explanation: def dothis yield end x = dothis() { 'this' 'that' } How do I make 'x' be an array holding both the strings. Of course I can just make those strings into an array, but I want to do it from the dothis method. What do you know... After writing this, something occurred to me: def dothis yield([]).join("\n") end dothis {|a| a << 'this' a << 'that' } So that works. Would this be the best approach? Thanks! - Ivan -- Posted via http://www.ruby-forum.com/.