necojackarc’s blog

A software engineer's blog who works for a web service company

Entries from 2015-11-04 to 1 day

How to read a text file in batches with Ruby

When I was reviewing my colleague's source, I found awful code in his program. Like this:"./production.log") do |file| results = {} file.readline # skip header file.each_line do |line| key, value = process(line) results[key] = v…