Class: Tap::Tasks::Signal
- Defined in:
- lib/tap/tasks/signal.rb
Overview
::task signal via a task
Instance Attribute Summary collapse
-
#sig ⇒ Object
Returns the value of attribute sig.
Attributes inherited from Tap::Task
Attributes inherited from App::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(sig, config = {}, app = Tap::App.current) ⇒ Signal
constructor
A new instance of Signal.
- #process(*args) ⇒ Object
- #to_spec ⇒ Object
Methods inherited from Tap::Task
#associations, #call, #enq, #exe, #log, #on_complete, parser
Methods inherited from App::Api
#associations, help, inherited, #inspect, parse, parse!, parser
Methods included from Signals
Methods included from Signals::ModuleMethods
Constructor Details
#initialize(sig, config = {}, app = Tap::App.current) ⇒ Signal
Returns a new instance of Signal.
26 27 28 29 |
# File 'lib/tap/tasks/signal.rb', line 26 def initialize(sig, config={}, app=Tap::App.current) super(config, app) @sig = sig end |
Instance Attribute Details
#sig ⇒ Object
Returns the value of attribute sig.
24 25 26 |
# File 'lib/tap/tasks/signal.rb', line 24 def sig @sig end |
Class Method Details
.build(spec = {}, app = Tap::App.current) ⇒ Object
8 9 10 |
# File 'lib/tap/tasks/signal.rb', line 8 def build(spec={}, app=Tap::App.current) new(spec['sig'], spec['config'], app) end |
.convert_to_spec(parser, args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tap/tasks/signal.rb', line 12 def convert_to_spec(parser, args) if args.empty? raise "no signal specified" end { 'config' => parser.nested_config, 'sig' => args.shift } end |
Instance Method Details
#process(*args) ⇒ Object
31 32 33 |
# File 'lib/tap/tasks/signal.rb', line 31 def process(*args) app.signal(sig).call(args) end |
#to_spec ⇒ Object
35 36 37 38 39 |
# File 'lib/tap/tasks/signal.rb', line 35 def to_spec spec = super spec['sig'] = sig spec end |