mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use &.
and ||=
instead of if guards
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
71a7931fb3
commit
64676baeef
1 changed files with 3 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue