From: Tobias Weber Date: 2008-05-30T07:44:58+09:00 Subject: Re: PHP to Ruby (associative array to Hash) In article <483F26CE.1090106@comcast.net>, "S.D" wrote: > def getTypes(grp_type) > res_types=Hash.new > if(!grp_type) then Only FalseClass and NilClass are false in Ruby, so if it can be an empty string you need to check that differently > @types Since the if/end is not the last expression in the function this will never be returned as a value. Use explicit return. > else > if(groups.has_key?(grp_type)) then > types.each do |k,v| > if(groups[grp_type].has_value?(v)) then > res_types[k]=v > end > end > else > res_types=false > end > end > res_types > end You might be better off rewriting from scratch than translating from PHP. You could start by documenting what the functions *do* ;) -- Tobias Weber