@@ -18,55 +18,55 @@ module Core
1818 ##
1919 # @private Helps organize configuration options for Stackdriver
2020 # instrumentation libraries. It's initialized with a nested list of
21- # predefined option keys, then only allows getting and setting these
21+ # predefined category keys, then only allows getting and setting these
2222 # predefined options.
2323 #
2424 # @example
25- # nested_categories = [:nested1 , {nested2 : [:nested3 ]}]
26- # config = Stackdriver::Core::Configuration.new nested: nested_categories
25+ # nested_categories = [:cat1 , {cat2 : [:cat3 ]}]
26+ # config = Stackdriver::Core::Configuration.new nested_categories
2727 #
2828 # config.opt1 #=> nil
2929 # config.opt1 = true #=> true
3030 # config.opt1 #=> true
3131 #
32- # config.nested1 #=> <Stackdriver::Core::Configuration>
33- # config.nested2.nested3 #=> <Stackdriver::Core::Configuration>
32+ # config.cat1 #=> <Stackdriver::Core::Configuration>
33+ # config.cat2.cat3 #=> <Stackdriver::Core::Configuration>
3434 #
3535 class Configuration < Hash
3636 ##
3737 # Constructs a new instance of Configuration object.
3838 #
39- # @param [Symbol, Array<Symbol, Hash>, Hash<Symbol, (Array, Hash)>] nested
40- # A Symbol, or nested Array and Hash of sub configuration categories.
41- # A single symbol, or symbols in array, will be key(s) to next level of
42- # categories. Nested hash represent sub categories with further nested
43- # sub categories.
39+ # @param [Symbol, Array<Symbol, Hash>, Hash<Symbol, (Array, Hash)>]
40+ # categories A Symbol, or nested Array and Hash of sub configuration
41+ # categories. A single symbol, or symbols in array, will be key(s) to
42+ # next level of categories. Nested hash represent sub categories with
43+ # further nested sub categories.
4444 #
45- def initialize nested = { }
45+ def initialize categories = { }
4646 super ( )
4747
48- add_nested nested
48+ add_options categories
4949 end
5050
5151 ##
52- # Add nested sub configurations to a Configuration object
52+ # Add nested sub configuration categories to a Configuration object
5353 #
54- # @param [Symbol, Array<Symbol, Hash>, Hash<Symbol, (Array, Hash)>] nested
55- # A Symbol, or nested Array and Hash of sub configuration categories.
56- # A single symbol, or symbols in array, will be key(s) to next level of
57- # categories. Nested hash represent sub categories with further nested
58- # sub categories.
54+ # @param [Symbol, Array<Symbol, Hash>, Hash<Symbol, (Array, Hash)>]
55+ # categories A Symbol, or nested Array and Hash of sub configuration
56+ # categories. A single symbol, or symbols in array, will be key(s) to
57+ # next level of categories. Nested hash represent sub categories with
58+ # further nested sub categories.
5959 #
6060 # @example
6161 # config = Stackdriver::Core::Configuration.new
62- # config.nest1 #=> nil
63- # config.add_nested {nest1 : [nest2 ]}
64- # config.nest1 #=> <Stackdriver::Core::Configuration>
65- # config.nest1.nest2 #=> <Stackdriver::Core::Configuration>
62+ # config.cat1 #=> nil
63+ # config.add_options {cat1 : [:cat2 ]}
64+ # config.cat1 #=> <Stackdriver::Core::Configuration>
65+ # config.cat1.cat2 #=> <Stackdriver::Core::Configuration>
6666 #
67- def add_nested nested
68- nested = [ nested ] . flatten ( 1 )
69- nested . each do |sub_key |
67+ def add_options categories
68+ categories = [ categories ] . flatten ( 1 )
69+ categories . each do |sub_key |
7070 case sub_key
7171 when Symbol
7272 self [ sub_key ] = self . class . new
0 commit comments