1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
normal 2018-01-18 00:52:01 +00:00
parent 900bf7682e
commit f729089f44

View file

@ -479,9 +479,7 @@ class Logger
# device exists, return +nil+. # device exists, return +nil+.
# #
def <<(msg) def <<(msg)
unless @logdev.nil? @logdev&.write(msg)
@logdev.write(msg)
end
end end
# #
@ -568,7 +566,7 @@ class Logger
# Close the logging device. # Close the logging device.
# #
def close def close
@logdev.close if @logdev @logdev&.close
end end
private private