lib/ffi/libfuse/ackbar.rb in ffi-libfuse-0.0.1.rctest12 vs lib/ffi/libfuse/ackbar.rb in ffi-libfuse-0.1.0.rc20220550
- old
+ new
@@ -27,18 +27,18 @@
signals&.restore
end
end
# @param [Hash<Symbol|String|Integer,String|Proc>] traps
- # Map of signal or signo to signal handler as per Signal.trap
+ # Map of signal or signo to signal handler as per {::Signal.trap}
# @param [Boolean] force
- # If not set traps that are not currently set to 'DEFAULT' will be ignored
+ # Unless set, only installs traps currently set to 'DEFAULT'.
def initialize(traps, force: false, signal: Signal)
@signal = signal
@traps = traps.transform_keys { |k| signame(k) }
@pr, @pw = ::IO.pipe
@monitor = nil
- @restore = @traps.map { |(sig, handler)| [sig, trap(sig, handler, force: force)] }.to_h
+ @restore = @traps.to_h { |sig, handler| [sig, trap(sig, handler, force: force)] }
end
# Handle the next available signal on the pipe (without blocking)
# @return [Boolean] false if pipe is closed, true if pipe would block
# @return [Array<String,Object>] signal name, signal result when a signal has been processed