From: Jason Lillywhite Date: 2008-09-21T00:46:42+09:00 Subject: iterating methods on multiple parameters I'm thinking there must be a great Ruby-way to do the same thing to many different variables. Here is a boiled down version of what I have: @yn = Unit.new("#{@yn} feet") @yc = Unit.new("#{yc} feet") @v = Unit.new("#{@v} fps") @twmax = Unit.new("#{@twmax} lbs/ft^2") @tc = Unit.new("#{@tc} lbs/ft^2") @twc = Unit.new("#{@twc} lbs/ft^2") My first thought is to create a hash of variables like this: results = {'yn' => "#{@yn} feet", 'yc' => "#{yc} feet", 'v' => "#{@v} fps", 'twmax' => "#{twmax} lbs/ft^2", 'tc' => "#{tc} lbs/ft^2", 'twc' => "#{twc} lbs/ft^2"} then use a block something like this? results.each_value {|item| Unit.new(item)} ...but that doesn't seem to work. Any ideas to make this better? Thank you! -- Posted via http://www.ruby-forum.com/.