mirror of
https://github.com/inspec/inspec
synced 2024-11-22 12:43:07 +00:00
Revert to a small amount of duplicating to_hash in inspec/input.rb
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
11074bb7ce
commit
88ed1794cb
3 changed files with 13 additions and 2 deletions
|
@ -318,6 +318,17 @@ module Inspec
|
|||
!current_value.is_a? NO_VALUE_SET
|
||||
end
|
||||
|
||||
def to_hash
|
||||
as_hash = { name: name, options: {} }
|
||||
%i{description title identifier type required value}.each do |field|
|
||||
val = send(field)
|
||||
next if val.nil?
|
||||
|
||||
as_hash[:options][field] = val
|
||||
end
|
||||
as_hash
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------#
|
||||
# Value Type Coercion
|
||||
#--------------------------------------------------------------------------#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "forwardable"
|
||||
require "singleton"
|
||||
require "inspec/objects/input"
|
||||
require "inspec/input"
|
||||
require "inspec/secrets"
|
||||
require "inspec/exceptions"
|
||||
require "inspec/plugin/v2"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "helper"
|
||||
require "inspec/objects/input"
|
||||
require "inspec/input"
|
||||
|
||||
describe Inspec::Input do
|
||||
let(:opts) { {} }
|
||||
|
|
Loading…
Reference in a new issue