tsumanne 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,580 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `mixlib-config` gem.
5
+ # Please instead update this file by running `bin/tapioca gem mixlib-config`.
6
+
7
+ # source://mixlib-config//lib/mixlib/config/version.rb#19
8
+ module Mixlib; end
9
+
10
+ # source://mixlib-config//lib/mixlib/config/version.rb#20
11
+ module Mixlib::Config
12
+ # Get the value of a config option
13
+ #
14
+ # === Parameters
15
+ # config_option<Symbol>:: The config option to return
16
+ #
17
+ # === Returns
18
+ # value:: The value of the config option
19
+ #
20
+ # === Raises
21
+ # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on.
22
+ #
23
+ # source://mixlib-config//lib/mixlib/config.rb#116
24
+ def [](config_option); end
25
+
26
+ # Set the value of a config option
27
+ #
28
+ # === Parameters
29
+ # config_option<Symbol>:: The config option to set (within the [])
30
+ # value:: The value for the config option
31
+ #
32
+ # === Returns
33
+ # value:: The new value of the config option
34
+ #
35
+ # === Raises
36
+ # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on.
37
+ #
38
+ # source://mixlib-config//lib/mixlib/config.rb#131
39
+ def []=(config_option, value); end
40
+
41
+ # metaprogramming to ensure that the slot for method_symbol
42
+ # gets set to value after any other logic is run
43
+ #
44
+ # === Parameters
45
+ # method_symbol<Symbol>:: Name of the method (variable setter)
46
+ # blk<Block>:: logic block to run in setting slot method_symbol to value
47
+ # value<Object>:: Value to be set in config hash
48
+ #
49
+ # source://mixlib-config//lib/mixlib/config.rb#331
50
+ def config_attr_writer(method_symbol, &block); end
51
+
52
+ # Allows you to create a new config context where you can define new
53
+ # options with default values.
54
+ #
55
+ # This method allows you to open up the configurable more than once.
56
+ #
57
+ # For example:
58
+ #
59
+ # config_context :server_info do
60
+ # configurable(:url).defaults_to("http://localhost")
61
+ # end
62
+ #
63
+ # === Parameters
64
+ # symbol<Symbol>: the name of the context
65
+ # block<Block>: a block that will be run in the context of this new config
66
+ # class.
67
+ #
68
+ # source://mixlib-config//lib/mixlib/config.rb#400
69
+ def config_context(symbol, &block); end
70
+
71
+ # Allows you to create a new hash of config contexts where you can define new
72
+ # options with default values.
73
+ #
74
+ # This method allows you to open up the configurable more than once.
75
+ #
76
+ # For example:
77
+ #
78
+ # config_context_hash :listeners, :listener do
79
+ # configurable(:url).defaults_to("http://localhost")
80
+ # end
81
+ #
82
+ # === Parameters
83
+ # symbol<Symbol>: the plural name for contexts in the list
84
+ # symbol<Symbol>: the singular name for contexts in the list
85
+ # block<Block>: a block that will be run in the context of this new config
86
+ # class.
87
+ #
88
+ # source://mixlib-config//lib/mixlib/config.rb#470
89
+ def config_context_hash(plural_symbol, singular_symbol, &block); end
90
+
91
+ # Allows you to create a new list of config contexts where you can define new
92
+ # options with default values.
93
+ #
94
+ # This method allows you to open up the configurable more than once.
95
+ #
96
+ # For example:
97
+ #
98
+ # config_context_list :listeners, :listener do
99
+ # configurable(:url).defaults_to("http://localhost")
100
+ # end
101
+ #
102
+ # === Parameters
103
+ # symbol<Symbol>: the plural name for contexts in the list
104
+ # symbol<Symbol>: the singular name for contexts in the list
105
+ # block<Block>: a block that will be run in the context of this new config
106
+ # class.
107
+ #
108
+ # source://mixlib-config//lib/mixlib/config.rb#438
109
+ def config_context_list(plural_symbol, singular_symbol, &block); end
110
+
111
+ # Gets or sets strict mode. When strict mode is on, only values which
112
+ # were specified with configurable(), default() or writes_with() may be
113
+ # retrieved or set. Getting or setting anything else will cause
114
+ # Mixlib::Config::UnknownConfigOptionError to be thrown.
115
+ #
116
+ # If this is set to :warn, unknown values may be get or set, but a warning
117
+ # will be printed with Chef::Log.warn if this occurs.
118
+ #
119
+ # === Parameters
120
+ # value<String>:: pass this value to set strict mode [optional]
121
+ #
122
+ # === Returns
123
+ # Current value of config_strict_mode
124
+ #
125
+ # === Raises
126
+ # <ArgumentError>:: if value is set to something other than true, false, or :warn
127
+ #
128
+ # source://mixlib-config//lib/mixlib/config.rb#505
129
+ def config_strict_mode(value = T.unsafe(nil)); end
130
+
131
+ # Sets strict mode. When strict mode is on, only values which
132
+ # were specified with configurable(), default() or writes_with() may be
133
+ # retrieved or set. All other values
134
+ #
135
+ # If this is set to :warn, unknown values may be get or set, but a warning
136
+ # will be printed with Chef::Log.warn if this occurs.
137
+ #
138
+ # === Parameters
139
+ # value<String>:: pass this value to set strict mode [optional]
140
+ #
141
+ # === Raises
142
+ # <ArgumentError>:: if value is set to something other than true, false, or :warn
143
+ #
144
+ # source://mixlib-config//lib/mixlib/config.rb#534
145
+ def config_strict_mode=(value); end
146
+
147
+ # metaprogramming to set information about a config option. This may be
148
+ # used in one of two ways:
149
+ #
150
+ # 1. Block-based:
151
+ # configurable(:attr) do
152
+ # defaults_to 4
153
+ # writes_value { |value| 10 }
154
+ # end
155
+ #
156
+ # 2. Chain-based:
157
+ # configurable(:attr).defaults_to(4).writes_value { |value| 10 }
158
+ #
159
+ # Currently supported configuration:
160
+ #
161
+ # defaults_to(value): value returned when configurable has no explicit value
162
+ # defaults_to BLOCK: block is run when the configurable has no explicit value
163
+ # writes_value BLOCK: block that is run to filter a value when it is being set
164
+ #
165
+ # === Parameters
166
+ # symbol<Symbol>:: Name of the config option
167
+ # default_value<Object>:: Default value [optional]
168
+ # block<Block>:: Logic block that calculates default value [optional]
169
+ #
170
+ # === Returns
171
+ # The value of the config option.
172
+ #
173
+ # source://mixlib-config//lib/mixlib/config.rb#370
174
+ def configurable(symbol, &block); end
175
+
176
+ # Pass Mixlib::Config.configure() a block, and it will yield itself
177
+ #
178
+ # === Parameters
179
+ # block<Block>:: A block that is called with self.configuration as the argument.
180
+ #
181
+ # @yield [configuration]
182
+ #
183
+ # source://mixlib-config//lib/mixlib/config.rb#102
184
+ def configure(&block); end
185
+
186
+ # metaprogramming to set the default value for the given config option
187
+ #
188
+ # === Parameters
189
+ # symbol<Symbol>:: Name of the config option
190
+ # default_value<Object>:: Default value (can be unspecified)
191
+ # block<Block>:: Logic block that calculates default value
192
+ #
193
+ # source://mixlib-config//lib/mixlib/config.rb#341
194
+ def default(symbol, default_value = T.unsafe(nil), &block); end
195
+
196
+ # Resets a config option to its default.
197
+ #
198
+ # === Parameters
199
+ # symbol<Symbol>:: Name of the config option
200
+ #
201
+ # source://mixlib-config//lib/mixlib/config.rb#162
202
+ def delete(symbol); end
203
+
204
+ # Loads a given ruby file, and runs instance_eval against it in the context of the current
205
+ # object.
206
+ #
207
+ # Raises an IOError if the file cannot be found, or is not readable.
208
+ #
209
+ # === Parameters
210
+ # filename<String>:: A filename to read from
211
+ #
212
+ # source://mixlib-config//lib/mixlib/config.rb#55
213
+ def from_file(filename); end
214
+
215
+ # Transforms a Hash into method-style configuration syntax to be processed
216
+ #
217
+ # === Parameters
218
+ # hash<Hash>:: A Hash containing configuration
219
+ #
220
+ # source://mixlib-config//lib/mixlib/config.rb#94
221
+ def from_hash(hash); end
222
+
223
+ # Parses valid JSON structure into Ruby
224
+ #
225
+ # === Parameters
226
+ # filename<String>:: A filename to read from
227
+ #
228
+ # source://mixlib-config//lib/mixlib/config.rb#80
229
+ def from_json(filename); end
230
+
231
+ # source://mixlib-config//lib/mixlib/config.rb#85
232
+ def from_toml(filename); end
233
+
234
+ # Parses valid YAML structure into Ruby so it can be ingested into the Class
235
+ #
236
+ # === Parameters
237
+ # filename<String>:: A filename to read from
238
+ #
239
+ # source://mixlib-config//lib/mixlib/config.rb#71
240
+ def from_yaml(filename); end
241
+
242
+ # Check if Mixlib::Config has a config option.
243
+ #
244
+ # === Parameters
245
+ # key<Symbol>:: The config option to check for
246
+ #
247
+ # === Returns
248
+ # <True>:: If the config option exists
249
+ # <False>:: If the config option does not exist
250
+ #
251
+ # @return [Boolean]
252
+ #
253
+ # source://mixlib-config//lib/mixlib/config.rb#143
254
+ def has_key?(key); end
255
+
256
+ # Creates a shallow copy of the internal hash
257
+ # NOTE: remove this in 3.0 in favor of save. This is completely useless
258
+ # with default values and configuration_context.
259
+ #
260
+ # === Returns
261
+ # result of Hash#dup
262
+ #
263
+ # source://mixlib-config//lib/mixlib/config.rb#319
264
+ def hash_dup; end
265
+
266
+ # source://mixlib-config//lib/mixlib/config.rb#44
267
+ def initialize_mixlib_config; end
268
+
269
+ # @return [Boolean]
270
+ #
271
+ # source://mixlib-config//lib/mixlib/config.rb#149
272
+ def is_default?(key); end
273
+
274
+ # Check if Mixlib::Config has a config option.
275
+ #
276
+ # === Parameters
277
+ # key<Symbol>:: The config option to check for
278
+ #
279
+ # === Returns
280
+ # <True>:: If the config option exists
281
+ # <False>:: If the config option does not exist
282
+ #
283
+ # @return [Boolean]
284
+ #
285
+ # source://mixlib-config//lib/mixlib/config.rb#143
286
+ def key?(key); end
287
+
288
+ # Return the set of config hash keys.
289
+ # This *only* returns hash keys which have been set by the user. In future
290
+ # versions this will likely be removed in favor of something more explicit.
291
+ # For now though, we want this to match has_key?
292
+ #
293
+ # === Returns
294
+ # result of Hash#keys
295
+ #
296
+ # source://mixlib-config//lib/mixlib/config.rb#309
297
+ def keys; end
298
+
299
+ # Merge an incoming hash with our config options
300
+ #
301
+ # === Parameters
302
+ # hash<Hash>: a hash in the same format as output by save.
303
+ #
304
+ # === Returns
305
+ # self
306
+ #
307
+ # source://mixlib-config//lib/mixlib/config.rb#290
308
+ def merge!(hash); end
309
+
310
+ # Allows for simple lookups and setting of config options via method calls
311
+ # on Mixlib::Config. If there any arguments to the method, they are used to set
312
+ # the value of the config option. Otherwise, it's a simple get operation.
313
+ #
314
+ # === Parameters
315
+ # method_symbol<Symbol>:: The method called. Must match a config option.
316
+ # *args:: Any arguments passed to the method
317
+ #
318
+ # === Returns
319
+ # value:: The value of the config option.
320
+ #
321
+ # === Raises
322
+ # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on.
323
+ #
324
+ # source://mixlib-config//lib/mixlib/config.rb#555
325
+ def method_missing(method_symbol, *args); end
326
+
327
+ # Resets all config options to their defaults.
328
+ #
329
+ # source://mixlib-config//lib/mixlib/config.rb#167
330
+ def reset; end
331
+
332
+ # Restore non-default values from the given hash.
333
+ #
334
+ # === Parameters
335
+ # hash<Hash>: a hash in the same format as output by save.
336
+ #
337
+ # === Returns
338
+ # self
339
+ #
340
+ # source://mixlib-config//lib/mixlib/config.rb#252
341
+ def restore(hash); end
342
+
343
+ # Makes a copy of any non-default values.
344
+ #
345
+ # This returns a shallow copy of the hash; while the hash itself is
346
+ # duplicated a la dup, modifying data inside arrays and hashes may modify
347
+ # the original Config object.
348
+ #
349
+ # === Returns
350
+ #
351
+ # Hash of values the user has set.
352
+ #
353
+ # === Examples
354
+ #
355
+ # For example, this config class:
356
+ #
357
+ # class MyConfig < Mixlib::Config
358
+ # default :will_be_set, 1
359
+ # default :will_be_set_to_default, 1
360
+ # default :will_not_be_set, 1
361
+ # configurable(:computed_value) { |x| x*2 }
362
+ # config_context :group do
363
+ # default :will_not_be_set, 1
364
+ # end
365
+ # config_context :group_never_set
366
+ # end
367
+ #
368
+ # MyConfig.x = 2
369
+ # MyConfig.will_be_set = 2
370
+ # MyConfig.will_be_set_to_default = 1
371
+ # MyConfig.computed_value = 2
372
+ # MyConfig.group.x = 3
373
+ #
374
+ # produces this:
375
+ #
376
+ # MyConfig.save == {
377
+ # :x => 2,
378
+ # :will_be_set => 2,
379
+ # :will_be_set_to_default => 1,
380
+ # :computed_value => 4,
381
+ # :group => {
382
+ # :x => 3
383
+ # }
384
+ # }
385
+ #
386
+ # source://mixlib-config//lib/mixlib/config.rb#215
387
+ def save(include_defaults = T.unsafe(nil)); end
388
+
389
+ # Makes a copy of any non-default values.
390
+ #
391
+ # This returns a shallow copy of the hash; while the hash itself is
392
+ # duplicated a la dup, modifying data inside arrays and hashes may modify
393
+ # the original Config object.
394
+ #
395
+ # === Returns
396
+ #
397
+ # Hash of values the user has set.
398
+ #
399
+ # === Examples
400
+ #
401
+ # For example, this config class:
402
+ #
403
+ # class MyConfig < Mixlib::Config
404
+ # default :will_be_set, 1
405
+ # default :will_be_set_to_default, 1
406
+ # default :will_not_be_set, 1
407
+ # configurable(:computed_value) { |x| x*2 }
408
+ # config_context :group do
409
+ # default :will_not_be_set, 1
410
+ # end
411
+ # config_context :group_never_set
412
+ # end
413
+ #
414
+ # MyConfig.x = 2
415
+ # MyConfig.will_be_set = 2
416
+ # MyConfig.will_be_set_to_default = 1
417
+ # MyConfig.computed_value = 2
418
+ # MyConfig.group.x = 3
419
+ #
420
+ # produces this:
421
+ #
422
+ # MyConfig.save == {
423
+ # :x => 2,
424
+ # :will_be_set => 2,
425
+ # :will_be_set_to_default => 1,
426
+ # :computed_value => 4,
427
+ # :group => {
428
+ # :x => 3
429
+ # }
430
+ # }
431
+ #
432
+ # source://mixlib-config//lib/mixlib/config.rb#215
433
+ def to_hash(include_defaults = T.unsafe(nil)); end
434
+
435
+ protected
436
+
437
+ # Given a (nested) Hash, apply it to the config object and any contexts.
438
+ #
439
+ # This is preferable to converting it to the string representation with
440
+ # the #to_dotted_hash method above.
441
+ #
442
+ # === Parameters
443
+ # hash<Hash>:: The hash to apply to the config object
444
+ #
445
+ # source://mixlib-config//lib/mixlib/config.rb#569
446
+ def apply_nested_hash(hash); end
447
+
448
+ private
449
+
450
+ # source://mixlib-config//lib/mixlib/config.rb#659
451
+ def define_attr_accessor_methods(symbol); end
452
+
453
+ # source://mixlib-config//lib/mixlib/config.rb#729
454
+ def define_context(definition_blocks); end
455
+
456
+ # source://mixlib-config//lib/mixlib/config.rb#703
457
+ def define_hash_attr_accessor_methods(plural_symbol, singular_symbol); end
458
+
459
+ # source://mixlib-config//lib/mixlib/config.rb#682
460
+ def define_list_attr_accessor_methods(plural_symbol, singular_symbol); end
461
+
462
+ # source://mixlib-config//lib/mixlib/config.rb#629
463
+ def internal_get(symbol); end
464
+
465
+ # source://mixlib-config//lib/mixlib/config.rb#648
466
+ def internal_get_or_set(symbol, *args); end
467
+
468
+ # Internal dispatch setter for config values.
469
+ #
470
+ # === Parameters
471
+ # symbol<Symbol>:: Name of the method (variable setter)
472
+ # value<Object>:: Value to be set in config hash
473
+ #
474
+ # source://mixlib-config//lib/mixlib/config.rb#614
475
+ def internal_set(symbol, value); end
476
+
477
+ # Given a (nested) Hash, turn it into a single top-level hash using dots as
478
+ # nesting notation. This allows for direction translation into method-style
479
+ # setting of Config.
480
+ #
481
+ # === Parameters
482
+ # hash<Hash>:: The hash to "de-nestify"
483
+ # recursive_key<String>:: The existing key to prepend going forward
484
+ #
485
+ # === Returns
486
+ # value:: A single-depth Hash using dot notation to indicate nesting
487
+ #
488
+ # source://mixlib-config//lib/mixlib/config.rb#597
489
+ def to_dotted_hash(hash, recursive_key = T.unsafe(nil)); end
490
+
491
+ class << self
492
+ # @private
493
+ #
494
+ # source://mixlib-config//lib/mixlib/config.rb#29
495
+ def extended(base); end
496
+ end
497
+ end
498
+
499
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#21
500
+ class Mixlib::Config::Configurable
501
+ # @return [Configurable] a new instance of Configurable
502
+ #
503
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#26
504
+ def initialize(symbol); end
505
+
506
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#69
507
+ def default; end
508
+
509
+ # Returns the value of attribute default_block.
510
+ #
511
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#24
512
+ def default_block; end
513
+
514
+ # @return [Boolean]
515
+ #
516
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#38
517
+ def default_block?; end
518
+
519
+ # Returns the value of attribute default_value.
520
+ #
521
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#23
522
+ def default_value; end
523
+
524
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#44
525
+ def defaults_to(default_value = T.unsafe(nil), &block); end
526
+
527
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#55
528
+ def get(config); end
529
+
530
+ # @return [Boolean]
531
+ #
532
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#30
533
+ def has_default; end
534
+
535
+ # @return [Boolean]
536
+ #
537
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#30
538
+ def has_default?; end
539
+
540
+ # @return [Boolean]
541
+ #
542
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#77
543
+ def is_default?(config); end
544
+
545
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#65
546
+ def set(config, value); end
547
+
548
+ # Returns the value of attribute symbol.
549
+ #
550
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#22
551
+ def symbol; end
552
+
553
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#50
554
+ def writes_value(&block); end
555
+
556
+ # @return [Boolean]
557
+ #
558
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#34
559
+ def writes_value?; end
560
+
561
+ private
562
+
563
+ # source://mixlib-config//lib/mixlib/config/configurable.rb#83
564
+ def safe_dup(e); end
565
+ end
566
+
567
+ # source://mixlib-config//lib/mixlib/config.rb#486
568
+ Mixlib::Config::NOT_PASSED = T.let(T.unsafe(nil), Object)
569
+
570
+ # source://mixlib-config//lib/mixlib/config/reopened_config_context_with_configurable_error.rb#21
571
+ class Mixlib::Config::ReopenedConfigContextWithConfigurableError < ::StandardError; end
572
+
573
+ # source://mixlib-config//lib/mixlib/config/reopened_configurable_with_config_context_error.rb#21
574
+ class Mixlib::Config::ReopenedConfigurableWithConfigContextError < ::StandardError; end
575
+
576
+ # source://mixlib-config//lib/mixlib/config/unknown_config_option_error.rb#21
577
+ class Mixlib::Config::UnknownConfigOptionError < ::StandardError; end
578
+
579
+ # source://mixlib-config//lib/mixlib/config/version.rb#22
580
+ Mixlib::Config::VERSION = T.let(T.unsafe(nil), String)