Skip to content

Instantly share code, notes, and snippets.

@Devalo
Created February 9, 2016 18:38
Show Gist options
  • Select an option

  • Save Devalo/b97feae5a7d22d0e2f68 to your computer and use it in GitHub Desktop.

Select an option

Save Devalo/b97feae5a7d22d0e2f68 to your computer and use it in GitHub Desktop.
def delete(line)
tmp = Tempfile.new("todo_temp")
open(file, "r").each.with_index do |index, l|
tmp << l unless line == index.to_i
end
tmp.close
FileUtils.mv(tmp.path, file)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment