Method: Puppet::Util::Settings::Setting#to_config

Defined in:
lib/vendor/puppet/util/settings/setting.rb

#to_configObject

Convert the object to a config statement.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/vendor/puppet/util/settings/setting.rb', line 67

def to_config
  str = @desc.gsub(/^/, "# ") + "\n"

  # Add in a statement about the default.
  str += "# The default value is '#{@default}'.\n" if @default

  # If the value has not been overridden, then print it out commented
  # and unconverted, so it's clear that that's the default and how it
  # works.
  value = @settings.value(self.name)

  if value != @default
    line = "#{@name} = #{value}"
  else
    line = "# #{@name} = #{@default}"
  end

  str += line + "\n"

  str.gsub(/^/, "    ")
end