Module: Tap::Signals
- Extended by:
- ModuleMethods
- Included in:
- App, App::Api, Env
- Defined in:
- lib/tap/signals.rb,
lib/tap/signals/help.rb,
lib/tap/signals/load.rb,
lib/tap/signals/configure.rb,
lib/tap/signals/class_methods.rb,
lib/tap/signals/module_methods.rb
Overview
Signals is a module providing signaling capbilities for objects. Signals are effectively bound to methods with pre-processing that allows inputs from the command line (ie an ARGV) or from interfaces like HTTP that commonly produce a parameters hash.
Defined Under Namespace
Modules: ClassMethods, ModuleMethods
Classes: Configure, Help, Load
Instance Method Summary
collapse
included
Instance Method Details
#sig(signal) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/tap/signals.rb', line 35
def sig(signal)
signal = signal.class
signals.each_pair do |sig, value|
return sig if value == signal
end
nil
end
|
#signal(sig, &block) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/tap/signals.rb', line 21
def signal(sig, &block)
sig = sig.to_s
unless signal = signals[sig]
raise "unknown signal: #{sig} (#{self.class})"
end
signal.new(self, &block)
end
|
#signal?(sig) ⇒ Boolean
30
31
32
33
|
# File 'lib/tap/signals.rb', line 30
def signal?(sig)
sig = sig.to_s
signals.has_key?(sig.to_s)
end
|
#signals ⇒ Object
14
15
16
17
18
19
|
# File 'lib/tap/signals.rb', line 14
def signals
self.class.signals
end
|