@@ -62,10 +62,24 @@ class Config
6262 class << self
6363 include Chef ::Mixin ::FromFile
6464
65+ # Pass Chef::Config.configure() a block, and it will yield @configuration.
66+ #
67+ # === Parameters
68+ # <block>:: A block that takes @configure as it's argument
6569 def configure ( &block )
6670 yield @configuration
6771 end
6872
73+ # Get the value of a configuration option
74+ #
75+ # === Parameters
76+ # config_option<Symbol>:: The configuration option to return
77+ #
78+ # === Returns
79+ # value:: The value of the configuration option
80+ #
81+ # === Raises
82+ # <ArgumentError>:: If the configuration option does not exist
6983 def []( config_option )
7084 if @configuration . has_key? ( config_option . to_sym )
7185 @configuration [ config_option . to_sym ]
@@ -74,14 +88,43 @@ def [](config_option)
7488 end
7589 end
7690
91+ # Set the value of a configuration option
92+ #
93+ # === Parameters
94+ # config_option<Symbol>:: The configuration option to set (within the [])
95+ # value:: The value for the configuration option
96+ #
97+ # === Returns
98+ # value:: The new value of the configuration option
7799 def []=( config_option , value )
78100 @configuration [ config_option . to_sym ] = value
79101 end
80102
103+ # Check if Chef::Config has a configuration option.
104+ #
105+ # === Parameters
106+ # key<Symbol>:: The configuration option to check for
107+ #
108+ # === Returns
109+ # <True>:: If the configuration option exists
110+ # <False>:: If the configuration option does not exist
81111 def has_key? ( key )
82112 @configuration . has_key? ( key . to_sym )
83113 end
84-
114+
115+ # Allows for simple lookups and setting of configuration options via method calls
116+ # on Chef::Config. If there any arguments to the method, they are used to set
117+ # the value of the configuration option. Otherwise, it's a simple get operation.
118+ #
119+ # === Parameters
120+ # method_symbol<Symbol>:: The method called. Must match a configuration option.
121+ # *args:: Any arguments passed to the method
122+ #
123+ # === Returns
124+ # value:: The value of the configuration option.
125+ #
126+ # === Raises
127+ # <ArgumentError>:: If the method_symbol does not match a configuration option.
85128 def method_missing ( method_symbol , *args )
86129 if @configuration . has_key? ( method_symbol )
87130 if args . length == 1
0 commit comments