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

View file

@ -1,33 +1,31 @@
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 when Fixnum then list.invert[s]
when Fixnum then list.invert[s]
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]
when Symbol then list[s.to_s] when Symbol then list[s.to_s]
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]
when Fixnum then list.invert[s] when Fixnum then list.invert[s]
else raise ArgumentError else raise ArgumentError
end
end end
end end
@ -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,