Method: Inspec::Attribute#to_ruby

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

#to_rubyObject



52
53
54
55
56
57
58
59
# File 'lib/inspec/objects/attribute.rb', line 52

def to_ruby
  res = ["#{ruby_var_identifier} = attribute('#{@name}',{"]
  res.push "  title: '#{title}'," unless title.to_s.empty?
  res.push "  default: #{default.inspect}," unless default.to_s.empty?
  res.push "  description: '#{description}'," unless description.to_s.empty?
  res.push '})'
  res.join("\n")
end