From: noterrain mee Date: 2013-07-26T12:56:47+09:00 Subject: replace words using gsub New to ruby! Body is a string, i am using the code directly below. I am not quite understand what does |k| and K means. This code shows the error "undefined method `default_proc=' for {"up"=>"down", "in"=>"out", "you"=>"he"}:Hash (NoMethodError)". Could someone help me out? subs = { "you" => "he", "up" => "down", "in" => "out"} subs.default_proc = proc {|k| k} body.gsub(/(?=\b).+(?=\b)/, subs) -- Posted via http://www.ruby-forum.com/.