ifを1行 gsuv
if を 1行で書く
処理 if 条件
gsub
マッチした文字と指定した文字を取り替える
s = "hello,\nworld\r\n" puts s.gsub(/(\r\n|\r|\n)/, "<br />") # => hello,<br />world<br />
処理 if 条件
マッチした文字と指定した文字を取り替える
s = "hello,\nworld\r\n" puts s.gsub(/(\r\n|\r|\n)/, "<br />") # => hello,<br />world<br />