class ComponentHost::Signal::Substitute::Signal
Constants
- Record
Public Instance Methods
handlers()
click to toggle source
# File lib/component_host/signal.rb, line 39 def handlers @handlers ||= {} end
records()
click to toggle source
# File lib/component_host/signal.rb, line 43 def records @records ||= [] end
send(signal)
click to toggle source
# File lib/component_host/signal.rb, line 27 def send(signal) handler = handlers[signal] return if handler.nil? handler.() record = Record.new signal records << record record end
trap(signal, &handler)
click to toggle source
# File lib/component_host/signal.rb, line 15 def trap(signal, &handler) handlers[signal] = handler end
trapped?(signal=nil)
click to toggle source
# File lib/component_host/signal.rb, line 19 def trapped?(signal=nil) if signal.nil? records.any? else records.any? { |record| record.signal == signal } end end