This commit is contained in:
Denis Knauf 2010-03-02 14:12:01 +01:00
parent c41586242a
commit 8877341fde

View file

@ -1,6 +1,5 @@
module Signal def Signal.signame s
def signame s
case s case s
when String then s when String then s
when Symbol then s.to_s when Symbol then s.to_s
@ -8,7 +7,7 @@ module Signal
end end
end end
def sig s def Signal.sig s
case s case s
when Fixnum then s when Fixnum then s
when String then list[s] when String then list[s]
@ -16,12 +15,12 @@ module Signal
end end
end end
list do |n, s| Signal.list do |n, s|
Signal.const_set n, s Signal.const_set n, s
Signal.const_set "SIG#{n}", s Signal.const_set "SIG#{n}", s
end end
def [] s def Signal.[] s
case s case s
when String then list[s] when String then list[s]
when Symbol then list[s.to_s] when Symbol then list[s.to_s]
@ -29,7 +28,6 @@ module Signal
else raise ArgumentError else raise ArgumentError
end end
end end
end
class Retries class Retries
attr_accessor :max, :range attr_accessor :max, :range
@ -59,7 +57,6 @@ class RobustServer
end end
def initialize *p def initialize *p
super *p
sh = method :signal_handler sh = method :signal_handler
@sigs = { @sigs = {
Signal[:INT] => sh, Signal[:HUP] => nil, Signal[:TERM] => sh, Signal[:INT] => sh, Signal[:HUP] => nil, Signal[:TERM] => sh,