lib/yle_tf/config.rb
# Returns a value from the configuration hierarchy specified by a list of
# keys. If the key is not specified, return result of a specied block, or
# raise `NotFoundError` if none specified.
Returns a value from the configuration hierarchy specified by a list of
keys. If the key is not specified, return result of a specied block, or
raise `NotFoundError` if none specified.
Returns a value from the configuration hierarchy specified by a list of keys . If the key is not specified return result of a specied block or raise ` NotFoundError ` if none specified .
def fetch(*keys, &block)
      block ||= DEFAULT_NOT_FOUND_BLOCK
      keys.inject(config) do |conf, key|
        next conf[key] if conf.is_a?(Hash) && conf.key?(key)
        if !conf.nil? && !conf.is_a?(Hash)
          Logger.warn(
            "Configuration [#{keys.join(' > ')}] includes non-hash element #{conf.inspect}"
          )
        end
        break block.call(keys)
      end
    end
def fetch ( * keys , & block ) block ||= DEFAULT_NOT_FOUND_BLOCK keys . inject ( config ) do | conf , key | next conf [ key ] if conf . is_a? ( Hash ) && conf . key? ( key ) if ! conf . nil? && ! conf . is_a? ( Hash ) Logger . warn ( "Configuration [#{keys.join(' > ')}] includes non-hash element #{conf.inspect}" ) end break block . call ( keys ) end end
Returns a value from the configuration hierarchy specified by a list of
keys.
Returns a value from the configuration hierarchy specified by a list of keys .
keys
block