Method: PDK::Config::Namespace#setting

Defined in:
lib/pdk/config/namespace.rb

#setting(key, &block) ⇒ nil

Pre-configure a value in the namespace.

Allows you to specify validators and a default value for value in the namespace (see PDK::Config::Value#initialize).

Parameters:

  • key (String, Symbol)

    the name of the value.

  • block (Proc)

    a block that is evaluated within the new [self].

Returns:

  • (nil)


51
52
53
54
# File 'lib/pdk/config/namespace.rb', line 51

def setting(key, &block)
  @settings[key.to_s] ||= default_setting_class.new(key.to_s, self)
  @settings[key.to_s].instance_eval(&block) if block_given?
end