Class: Epodder::Verb
Instance Method Summary
collapse
Methods inherited from Eclass
#initialize
Instance Method Details
#add_command(cmd, args) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/verb/verb.rb', line 8
def add_command(cmd, args)
command = CmdParse::Command.new(@verb.name, false, false)
command.short_desc = @verb.description
command.set_execution_block(&@verb.block)
cmd.add_command(command)
end
|
#each_argument(args, &block) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/verb/verb.rb', line 24
def each_argument(args, &block)
podcasts = lookup_args(args) || nil
podcasts.each do |podcast|
yield podcast
end
end
|
#lookup_args(args) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/verb/verb.rb', line 15
def lookup_args(args)
if args.empty?
podcasts = Podcast.all
else
podcasts = args.map { |id| Podcast.get(id.to_i) }
end
podcasts
end
|
#verb_struct ⇒ Object
3
4
5
6
|
# File 'lib/verb/verb.rb', line 3
def verb_struct
super
Struct.new(:name, :description, :block)
end
|