[why] when add a program to pp, it will declare { pp: program: {} } if the program does not has args, it will keep {} to pp.
[how] give a nil to program, then add program args when the program adds args. it will: { pp: program: }
Signed-off-by: Wei Jihui weijihuiall@163.com --- lib/job.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index 2e94316c..84ab5056 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -580,11 +580,14 @@ class Job program_name = hash_key_re_string(h, p_n, @job['pp'].keys) next if program_name.nil?
- @job["pp"][program_name] = Hash.new() + @job['pp'][program_name] = nil options_array = options_hash.keys options_array.each do |option| option_value = get_program_option_value(@job, program_name, option) - @job["pp"][program_name][option] = option_value unless option_value.nil? + next if option_value.nil? + + @job['pp'][program_name] ||= {} + @job['pp'][program_name][option] = option_value end end end