aboutsummaryrefslogtreecommitdiff
path: root/app/jobs/govuk_guix
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-03 22:05:42 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-03 22:05:42 +0100
commitd0332d05222169ffdbdb65d6d4e79b45a2bf789e (patch)
tree27129c2ff9bdda15909e9823a91d68bcc1d2e9fd /app/jobs/govuk_guix
parentc89386a109d7e89bb1f96f693f78f499724318f5 (diff)
downloadgovuk-mini-environment-admin-d0332d05222169ffdbdb65d6d4e79b45a2bf789e.tar
govuk-mini-environment-admin-d0332d05222169ffdbdb65d6d4e79b45a2bf789e.tar.gz
Support specifying multiple values for a single key
In the hash_to_arguments method of GovukGuix::Job.
Diffstat (limited to 'app/jobs/govuk_guix')
-rw-r--r--app/jobs/govuk_guix/job.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/jobs/govuk_guix/job.rb b/app/jobs/govuk_guix/job.rb
index fdac507..357c8ca 100644
--- a/app/jobs/govuk_guix/job.rb
+++ b/app/jobs/govuk_guix/job.rb
@@ -81,13 +81,15 @@ class GovukGuix::Job < Que::Job
end
def hash_to_arguments(hash)
- hash.map do |(key, value)|
+ hash.flat_map do |(key, value)|
transformed_key = key.tr('_', '-')
if value == true
- "--#{transformed_key}"
+ ["--#{transformed_key}"]
+ elsif value.kind_of?(Array)
+ value.map { |x| "--#{transformed_key}=#{x}" }
else
- "--#{transformed_key}=#{value}"
+ ["--#{transformed_key}=#{value}"]
end
end
end