Class: Epodder::Remove
Instance Method Summary collapse
-
#initialize ⇒ Remove
constructor
A new instance of Remove.
- #remove(args) ⇒ Object
Methods inherited from Verb
#add_command, #each_argument, #lookup_args, #verb_struct
Constructor Details
#initialize ⇒ Remove
Returns a new instance of Remove.
4 5 6 |
# File 'lib/verb/remove.rb', line 4 def initialize require 'highline/import' end |
Instance Method Details
#remove(args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/verb/remove.rb', line 8 def remove(args) each_argument(args) do |podcast| input = ask("Remove #{podcast.id} : #{podcast.title}? Type \"YES\" to remove") if input == 'YES' podcast.destroy end end args.map { |id| Podcast.get(id) }.each do |podcast| input = ask("Remove #{podcast.id} : #{podcast.title}? Type \"YES\" to remove") if input == 'YES' podcast.destroy end end end |