Send function with hash
I know my x.to_s is not working and I need to use .send(something) but I cannot get the syntax right. If you can show me the correct send syntax I'd appreciate it.
h = Hash.new @cars.each do|x| h["x.to_s"] = 0 end
If you mean to use the string representation of x as a hash key, remove the quotation marks:
h[x.to_s] = 0