class Til::NoteDeleter
Attributes
note[R]
Public Class Methods
new(note)
click to toggle source
# File lib/til/services/note_deleter.rb, line 7 def initialize(note) @note = note end
Public Instance Methods
delete()
click to toggle source
# File lib/til/services/note_deleter.rb, line 11 def delete begin choice = ask("Really delete \"#{note.title.bold}\" (in #{note.subject.bold})? (y/n)") if (choice == "y") || (choice == "yes") deleted_note_title = note.title File.delete(note.path) puts "\"#{deleted_note_title.bold}\" deleted.".green else puts "\"#{note.title.bold}\" not deleted.".red end rescue Interrupt warn "\nAborted!" abort end end