Module: Reality::Options
- Defined in:
- lib/reality/options.rb
Class Method Summary collapse
-
.check(options, valid_options, logging_container = nil, method_descriptor = nil) ⇒ Object
Set the levels on an array of loggers.
Class Method Details
.check(options, valid_options, logging_container = nil, method_descriptor = nil) ⇒ Object
Set the levels on an array of loggers. The levels parameter must be an array matching the number of loggers supplied or a single level. If a block is supplied then the levels are set to the specified values for the duration of the block and then reset to original values after the block completes.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/reality/options.rb', line 22 def check(, , logging_container = nil, method_descriptor = nil) = .keys.select { |k| !.include?(k) } return if .empty? single_error = .size == 1 = "Unknown option#{single_error ? '' : 's'} #{single_error ? "'#{bad_options.first.inspect}'" : bad_options.inspect} passed to #{method_descriptor || 'method'}" if logging_container logging_container.error() else raise ArgumentError.new() end end |