mimi-signal 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eaf7ad67ee461b781fc1f1dad8211b55bfa8402
4
- data.tar.gz: 32d0c1354c9965c8341b2dd35eaac502d306ed59
3
+ metadata.gz: f5fe64779f430f3c23d3e6c227c7dea62aaf0060
4
+ data.tar.gz: 2df25e8d2ece397bbb6e597424aa2ee5a56ecc45
5
5
  SHA512:
6
- metadata.gz: 676e87a4d4c36804ce7bb67108956f4eab5767952b3cb96951e10c93394e35cd7a1690968fbfa565220029d19f517b1e83ced712ae5d74dc06da507c2801e55e
7
- data.tar.gz: 35fb4e4a1c79b0e54d46fbb0153d1cadc92b8cb228aaf32d109c860037faaf7e88c93563079287c8ce334131feddc848850db3502b0cbb4cd4ae64f703809e24
6
+ metadata.gz: 655b4b768b371d983551481c14b61989601c37bdbd40809e3b44f9005f555dc1f32b89ef14a24a3a3b932d711019efc05bce7c778e1eaf14988e3121fc7d8c74
7
+ data.tar.gz: f378105358fe9be373da55e6f2039479ad2b3ae9746d4c58777999acda90e09f3feda96095d86c2bc5940cf36635e4e31db1887e4ed255c589909c4f0faddab2
@@ -1,5 +1,5 @@
1
1
  module Mimi
2
2
  class Signal
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
data/lib/mimi/signal.rb CHANGED
@@ -25,14 +25,15 @@ module Mimi
25
25
 
26
26
  private
27
27
 
28
+ # Creates a signal handler and installs it.
29
+ #
30
+ # @see Mimi::Signal.trap
31
+ #
28
32
  def initialize(signal, &block)
29
33
  self.class.handlers[signal.to_sym] ||= { old_trap: nil, blocks: [] }
30
34
  self.class.handlers[signal.to_sym][:blocks].push(block)
31
35
  self.class.handlers[signal.to_sym][:old_trap] ||=
32
- Kernel.trap(signal) do
33
- puts "#{self} got signal #{signal}"
34
- self.class.queue << signal.to_sym
35
- end
36
+ Kernel.trap(signal) { self.class.queue << signal.to_sym }
36
37
  self.class.start
37
38
  end
38
39
 
@@ -40,6 +41,11 @@ module Mimi
40
41
  #
41
42
  # @param [Array<String,Symbol>] signals
42
43
  #
44
+ # @example
45
+ # Mimi::Signal.trap('INT', 'TERM') do
46
+ # # graceful shutdown
47
+ # end
48
+ #
43
49
  def self.trap(*signals, &block)
44
50
  signals.each { |s| new(s, &block) }
45
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimi-signal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kukushkin