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

Public Class Methods

new(key, default, description) click to toggle source
# File lib/middleman-core/configuration.rb, line 210
def initialize(key, default, description)
  @value_set = false
  self.key = key
  self.default = default
  self.description = description
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 226
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 218
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 rubocop:disable TrivialAccessors

# File lib/middleman-core/configuration.rb, line 232
def value_set?
  @value_set
end