I'd like to refactor the following code: case @request.path when '/' Rack::Response.new do |response| do_stuff end when '/env' then Rack::Response.new(@env.to_html) end And extract `Rack::Response.new`, something like the following: Rack::Response.new case @request.path when '/' then Proc.new {|response| do_stuff } when '/env' then @env.to_html end But I get > stringable or iterable required What's the correct implementation (Ruby 1.9.2)?