Skip to content

Instantly share code, notes, and snippets.

@betawaffle
Created July 4, 2011 12:30
Show Gist options
  • Save betawaffle/1063284 to your computer and use it in GitHub Desktop.
Save betawaffle/1063284 to your computer and use it in GitHub Desktop.
module Helpers
def each_ln(filename)
File.open filename, 'r' do |f|
ln = 0 # Line Number
begin
while l = f.gets
l.strip!
ln += 1
yield l, ln
end
rescue Interrupt
perr :cr, red('Interrupted')
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment