Method: Inspec::Control#to_ruby

Defined in:
lib/inspec/objects/control.rb

#to_rubyObject



18
19
20
21
22
23
24
25
26
# File 'lib/inspec/objects/control.rb', line 18

def to_ruby
  res = ["control #{id.inspect} do"]
  res.push "  title #{title.inspect}" unless title.to_s.empty?
  res.push "  desc  #{desc.inspect}" unless desc.to_s.empty?
  res.push "  impact #{impact}" unless impact.nil?
  tests.each { |t| res.push(indent(t.to_ruby, 2)) }
  res.push 'end'
  res.join("\n")
end