Method: Inspec::Attribute#to_ruby

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

#to_rubyObject



43
44
45
46
47
48
49
50
# File 'lib/inspec/objects/attribute.rb', line 43

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