例子这样
"hello".chomp #=>"hello"
"hello\n".chomp #=>"hello"
"hello\r\n".chomp #=>"hello"
"hello\n\r".chomp #=>"hello\n"
"hello\r".chomp #=>"hello"
print "line 1: "line1 = STDIN.gets.chomp()print "line 2: "line2 = STDIN.gets.chomp()
print "line 3: "line3 = STDIN.gets.chomp()
puts "I'm going to write these to the file."
target.write( [ line1 ,line2 ,line3 ,'' ].join( '\n ' ) )