diff options
author | Ryan Davis <ryand-ruby@zenspider.com> | 2019-06-05 18:58:08 -0700 |
---|---|---|
committer | Ryan Davis <ryand-ruby@zenspider.com> | 2019-06-05 18:58:08 -0700 |
commit | ba8904c71357ddda0e18d95f3184307cd52be710 (patch) | |
tree | 859cf3905443b1d757f8080b978780e21983b14a /lib/mixlib | |
parent | 7e9373f5dd41a9ac258102df01f45bed8467f2f9 (diff) | |
download | mixlib-log-ba8904c71357ddda0e18d95f3184307cd52be710.tar.gz |
Check for the existence of the ivar before accessing it.
Makes the code run nearly warning free, reducing the output
of `rspec -w spec` by 42 lines. That has to mean something,
right?
Signed-off-by: Ryan Davis <zenspider@chef.io>
Diffstat (limited to 'lib/mixlib')
-rw-r--r-- | lib/mixlib/log.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb index 491bbc8..18cdfd3 100644 --- a/lib/mixlib/log.rb +++ b/lib/mixlib/log.rb @@ -190,6 +190,7 @@ module Mixlib # via public API. In order to reduce amount of impact and # handle only File type log devices I had to use this method # to get access to it. + next unless logger.instance_variable_defined?(:"@logdev") next unless (logdev = logger.instance_variable_get(:"@logdev")) loggers_to_close << logger if logdev.filename end |