diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-18 00:52:01 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-18 00:52:01 +0000 |
commit | f729089f44ec2911d5a668c114b749c45d3df0f6 (patch) | |
tree | 78a11219eca39c2cf880dbe01ceb18b917a9dc83 /lib | |
parent | 900bf7682e971175c6748f0d90d7b45ce942a810 (diff) | |
download | ruby-f729089f44ec2911d5a668c114b749c45d3df0f6.tar.gz |
logger: use safe navigation operator
Saves a few hundred bytes of bytecode in a frequently loaded module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/logger.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/logger.rb b/lib/logger.rb index 4ccc03b614..0615546d18 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -479,9 +479,7 @@ class Logger # device exists, return +nil+. # def <<(msg) - unless @logdev.nil? - @logdev.write(msg) - end + @logdev&.write(msg) end # @@ -568,7 +566,7 @@ class Logger # Close the logging device. # def close - @logdev.close if @logdev + @logdev&.close end private |