summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-22 23:11:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-22 23:11:41 +0000
commit64676baeef394e3619972e39615986472ef1783c (patch)
tree02336992fb37cb1d0ccdf5886600d849444959f5 /lib
parent71a7931fb3f58c55eaff9452f2bba0cb19102d44 (diff)
Use `&.` and `||=` instead of if guards
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/webrick/server.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index a3c2ab3ddf..b78014c459 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -312,22 +312,16 @@ module WEBrick
# Calls the callback +callback_name+ from the configuration with +args+
def call_callback(callback_name, *args)
- if cb = @config[callback_name]
- cb.call(*args)
- end
+ @config[callback_name]&.call(*args)
end
def setup_shutdown_pipe
- if !@shutdown_pipe
- @shutdown_pipe = IO.pipe
- end
- @shutdown_pipe
+ return @shutdown_pipe ||= IO.pipe
end
def cleanup_shutdown_pipe(shutdown_pipe)
@shutdown_pipe = nil
- return if !shutdown_pipe
- shutdown_pipe.each(&:close)
+ shutdown_pipe&.each(&:close)
end
def alarm_shutdown_pipe