4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bj/joblist.rb', line 4
def for jobs, options = {}
if Joblist === jobs
jobs.update options
return jobs
end
options.to_options!
jobs = [jobs].flatten.compact
list = []
jobs.each do |arg|
list.push(
case arg
when String
case arg
when %r/^\d+$/
job_from_id arg
else
job_from_string arg
end
when Hash
job_from_hash arg
when Io
jobs_from_io arg
when Fixnum, Bignum
job_from_number arg
else
job_from_string arg
end
)
end
list.flatten!
list.compact!
list.map!{|job| job.reverse_merge! options}
list
end
|