Ruby / Example of readlines / map(&:chomp)
From WhyNotWiki
< Ruby (Redirected from Ruby / Example of readlines / map()
irb -> require 'rubygems'
irb -> require 'extensions/symbol'
irb -> f = File.open('foo', 'w') { |f| f.puts 'line1'; f.puts 'line2' }
=> nil
irb -> File.readlines('foo')
=> ["line1\n", "line2\n"]
irb -> File.readlines('foo').map(&:chomp)
=> ["line1", "line2"]
