Method: Inspec::Attribute#to_ruby

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

#to_rubyObject



62
63
64
65
66
67
68
69
# File 'lib/inspec/objects/attribute.rb', line 62

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