Created
February 9, 2016 18:38
-
-
Save Devalo/b97feae5a7d22d0e2f68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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