Module: VagrantPlugins::ProxyConf::Config::KeyMixin::ClassMethods
- 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
-
#keys ⇒ Array<Key>
readonly
The configuration keys for the class.
-
#name ⇒ Object
Defines a configuration key for the class.
Instance Method Summary collapse
-
#key(name, opts = {}) ⇒ Object
Defines a configuration key for the class.
Instance Attribute Details
#keys ⇒ Array<Key> (readonly)
Returns the configuration keys for the class.
16 17 18 |
# File 'lib/vagrant-proxyconf/config/key_mixin.rb', line 16 def keys @keys ||= [] end |
#name ⇒ Object
Defines a configuration key for the class. Creates ‘attr_accessor` for the key name and adds a VagrantPlugins::ProxyConf::Config::Key to #keys.
26 27 28 29 |
# File 'lib/vagrant-proxyconf/config/key_mixin.rb', line 26 def key(name, opts = {}) self.class_eval { attr_accessor name } keys << Key.new(name, opts) 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.
26 27 28 29 |
# File 'lib/vagrant-proxyconf/config/key_mixin.rb', line 26 def key(name, opts = {}) self.class_eval { attr_accessor name } keys << Key.new(name, opts) end |