Also issue default: option for backwards compatibility

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-01-30 14:05:11 -05:00
parent 5868eb52e7
commit 18011ccfec

View file

@ -94,6 +94,10 @@ module Inspec
res = ["#{ruby_var_identifier} = attribute('#{@name}',{"]
res.push " title: '#{title}'," unless title.to_s.empty?
res.push " value: #{value.inspect}," unless value.to_s.empty?
# to_ruby may generate code that is to be used by older versions of inspec.
# Anything older than 3.4 will not recognize the value: option, so
# send the default: option as well. See #3759
res.push " default: #{value.inspect}," unless value.to_s.empty?
res.push " description: '#{description}'," unless description.to_s.empty?
res.push '})'
res.join("\n")