class FigTree::ConfigStruct

Class that defines and keeps the configuration values.

Public Class Methods

new(name) click to toggle source

@param name [String]

# File lib/fig_tree.rb, line 42
def initialize(name)
  @name = name
  @settings = {}
  @setting_objects = {}
  @setting_templates = {}
end

Public Instance Methods

deprecate(old_config, new_config) click to toggle source

Mark a configuration as deprecated and replaced with the new config. @param old_config [String] @param new_config [String]

# File lib/fig_tree.rb, line 58
def deprecate(old_config, new_config)
  @settings[old_config.to_sym] ||= ConfigValue.new
  @settings[old_config.to_sym].deprecation = new_config
end
reset!() click to toggle source

Reset config back to default values.

# File lib/fig_tree.rb, line 50
def reset!
  @setting_objects = @setting_templates.map { |k, _| [k, []] }.to_h
  @settings.values.each(&:reset!)
end