我有一些大的固定宽度文件,我需要删除标题行。
跟踪迭代器似乎不太习惯。
# This is what I do now.
File.open(filename).each_line.with_index do |line, idx|
if idx > 0
...
end
end
# This is what I want to do but I don't need drop(1) to slurp
# the file into an array.
File.open(filename).drop(1).each_line do { |line| ... }
Ruby 的成语是什么?