I'm learning Ruby and I'm reading some expression that I saw on the
forum. I'm coming from Javascript. This is really hard for me. Please
help explain to me in plain English. I understand that it's a Function
that takes string and count words to return a Hash.

def count_words(string)
  res = Hash.new(0)
  string.downcase.scan(/\w+/).map{|word| res[word] =
string.downcase.scan(/\b#{word}\b/).size}
  return res
end

-- 
Posted via http://www.ruby-forum.com/.