Method: Inspec::Control#to_ruby

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

#to_rubyObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/inspec/objects/control.rb', line 23

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