Module: Barometer::Utils::ConfigReader
- Defined in:
- lib/barometer/utils/config_reader.rb
Class Method Summary collapse
-
._dig(data, config, &block) ⇒ Object
iterate through the setup until we have a source name (and possibly a config for that source), then yield with that source and config.
- .services(level, &block) ⇒ Object
- .take_level_while(&block) ⇒ Object
Class Method Details
._dig(data, config, &block) ⇒ Object
iterate through the setup until we have a source name (and possibly a config for that source), then yield with that source and config
this allows for many different config formats, like { 1 => :wunderground } { 1 => [:wunderground]} { 1 => [:wunderground, :yahoo]} { 1 => [:wunderground, {weight: 2}]} { 1 => {weight: 2}} { 1 => [{weight: 2}]}
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/barometer/utils/config_reader.rb', line 25 def self._dig(data, config, &block) if data.respond_to?(:to_sym) yield(data.to_sym, config) elsif data.is_a?(Array) data.each do |datum| _dig(datum, {}, &block) end elsif data.is_a?(Hash) data.each do |datum, config| _dig(datum, config, &block) end end end |