Module: VagrantPlugins::ProxyConf::Config::KeyMixin::ClassMethods

Included in:
AptProxy, EnvProxy, Proxy
Defined in:
lib/vagrant-proxyconf/config/key_mixin.rb

Overview

Methods for the including class to specify and access the configuration keys.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keysArray<Key> (readonly)



16
17
18
# File 'lib/vagrant-proxyconf/config/key_mixin.rb', line 16

def keys
  @keys ||= []
end

Instance Method Details

#key(name, opts = {}) ⇒ Object

Defines a configuration key for the class. Creates ‘attr_accessor` for the key name and adds a VagrantPlugins::ProxyConf::Config::Key to #keys.

Options Hash (opts):

  • :default (String, nil) — default: nil

    the default value

  • :env_var (String, nil) — default: nil

    the environment variable that overrides the configuration



24
25
26
27
# File 'lib/vagrant-proxyconf/config/key_mixin.rb', line 24

def key(name, opts = {})
  self.class_eval { attr_accessor name }
  keys << Key.new(name, opts)
end