From: Charles Nutter Date: 2011-06-08T17:08:17+09:00 Subject: [ruby-core:36836] [Ruby 1.9 - Feature #4778] IO#each_chomped Issue #4778 has been updated by Charles Nutter. Trivial Ruby impl... class IO def each_chomped each {|x| yield x.chomp!} end end Of course if you don't mind the whole file being read into memory: io.each.map(&:chomp).each { ... Might be a way to pipeline that without reading into memory. ---------------------------------------- Feature #4778: IO#each_chomped http://redmine.ruby-lang.org/issues/4778 Author: Joey Zhou Status: Assigned Priority: Normal Assignee: Yukihiro Matsumoto Category: Target version: When manipulating text files, mostly, the input record separator(saying "\n") is scrap and will be chomped. I suggest a method IO#each_chomped directly yielding the record with input record separator chomped. Laziness is a virtue.. Joey -- http://redmine.ruby-lang.org