class Middleman::Configuration::ConfigSetting
An individual configuration setting, with an optional default and description. Also models whether or not a value has been set.
Attributes
default[RW]
The default value for this setting
description[RW]
A human-friendly description of the setting
key[RW]
The name of this setting
options[RW]
Additional config.
Public Class Methods
new(key, default, description, options={})
click to toggle source
# File lib/middleman-core/configuration.rb, line 130 def initialize(key, default, description, options={}) @value_set = false self.key = key self.default = default self.description = description self.options = options end
Public Instance Methods
value()
click to toggle source
The effective value of the setting, which may be the default if the user has not set a value themselves. Note that even if the user sets the value to nil it will override the default.
# File lib/middleman-core/configuration.rb, line 147 def value value_set? ? @value : default end
value=(value)
click to toggle source
The user-supplied value for this setting, overriding the default
# File lib/middleman-core/configuration.rb, line 139 def value=(value) @value = value @value_set = true end
value_set?()
click to toggle source
Whether or not there has been a value set beyond the default
# File lib/middleman-core/configuration.rb, line 152 def value_set? @value_set == true end