Class: Epodder::Catchup

Inherits:
Verb show all
Defined in:
lib/verb/catchup.rb

Instance Method Summary collapse

Methods inherited from Verb

#add_command, #each_argument, #lookup_args, #verb_struct

Methods inherited from Eclass

#initialize

Constructor Details

This class inherits a constructor from Epodder::Eclass

Instance Method Details

#catchup(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/verb/catchup.rb', line 3

def catchup(args)
    if args.empty?
        podcasts = Podcast.all
    else
        podcasts = args.map { |id| Podcast.get(id.to_i) }
    end
    podcasts.each do |podcast|
        Episode.all(downloaded: false, podcast: podcast).update(downloaded: true)
    end
end