module Jujube::Utils
Private utility methods.
Private Instance Methods
canonicalize(key)
click to toggle source
Convert a hash key into the canonical format required by jenkins-job-builder. Keys must be strings and use dashes (`-`) instead of underscores (`_`).
@param key [Symbol] The key to canonicalize. @return [String] The key in canonical format.
# File lib/jujube/utils.rb, line 12 def canonicalize(key) key.to_s.gsub("_", "-") end
canonicalize_options(options)
click to toggle source
Ensure that all of the keys in an options hash are in canonical jenkins-job-builder format. This method only looks at the top-level keys; it assumes that any nested hashes have already been {#canonicalize}d.
@param options [Hash] The options to canonicalize. @return [Hash] The options in canonical format.
# File lib/jujube/utils.rb, line 23 def canonicalize_options(options) Hash[options.map { |k, v| [canonicalize(k), v] }] end