vendor/bundle/ruby/2.6.0/gems/lumberjack-1.2.8/lib/lumberjack/tags.rb
# Ensure keys are strings and expand any values in a hash that are Proc's by calling them and replacing
# the value with the result. This allows setting global tags with runtime values.
Ensure keys are strings and expand any values in a hash that are Proc's by calling them and replacing
the value with the result. This allows setting global tags with runtime values.
Ensure keys are strings and expand any values in a hash that are Proc ' s by calling them and replacing the value with the result . This allows setting global tags with runtime values .
def expand_runtime_values(hash)
        return nil if hash.nil?
        if hash.all? { |key, value| key.is_a?(String) && !value.is_a?(Proc) }
          return hash
        end
        copy = {}
        hash.each do |key, value|
          if value.is_a?(Proc) && (value.arity == 0 || value.arity == -1)
            value = value.call
          end
          copy[key.to_s] = value
        end
        copy
      end
def expand_runtime_values ( hash ) return nil if hash . nil? if hash . all? { | key , value | key . is_a? ( String ) && ! value . is_a? ( Proc ) } return hash end copy = { } hash . each do | key , value | if value . is_a? ( Proc ) && ( value . arity == 0 || value . arity == - 1 ) value = value . call end copy [ key . to_s ] = value end copy end
Ensure keys are strings and expand any values in a hash that are Proc's by calling them and replacing
the value with the result.
Ensure keys are strings and expand any values in a hash that are Proc ' s by calling them and replacing the value with the result .
hash