ActiveSupport、String#squish, String#squish!
まんま
>> require "rubygems" => true >> require "active_support" => true >> s = " foo bar \n \t boo" => " foo bar \n \t boo" >> s.squish => "foo bar boo" >> s.squish! => "foo bar boo" >> s => "foo bar boo"
まんま
>> require "rubygems" => true >> require "active_support" => true >> s = " foo bar \n \t boo" => " foo bar \n \t boo" >> s.squish => "foo bar boo" >> s.squish! => "foo bar boo" >> s => "foo bar boo"