Class: Tower::Service
- Inherits:
-
Object
- Object
- Tower::Service
- Defined in:
- lib/tower/service.rb
Class Method Summary collapse
- .later(*args) ⇒ Object
-
.now(*args) ⇒ Object
run service now.
-
.takes(*names) ⇒ Object
Takes setup args for runners.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Service
constructor
Initialize takes any number of args which are set as instance variables.
- #perform ⇒ Object
-
#run ⇒ Object
Run called by Service.now after initializing new service override with service logic.
Constructor Details
#initialize(*args) ⇒ Service
Initialize takes any number of args which are set as instance variables
24 25 26 |
# File 'lib/tower/service.rb', line 24 def initialize(*args) set_instance_variables args end |
Class Method Details
.later(*args) ⇒ Object
17 18 19 |
# File 'lib/tower/service.rb', line 17 def self.later(*args) Tower::Queue.add self, *args end |
.now(*args) ⇒ Object
run service now
13 14 15 |
# File 'lib/tower/service.rb', line 13 def self.now(*args) new(*args).run end |
.takes(*names) ⇒ Object
Takes setup args for runners
5 6 7 8 |
# File 'lib/tower/service.rb', line 5 def self.takes(*names) return @takes if names.empty? @takes = names end |
Instance Method Details
#perform ⇒ Object
33 |
# File 'lib/tower/service.rb', line 33 def perform; run; end |
#run ⇒ Object
Run called by Service.now after initializing new service override with service logic
32 |
# File 'lib/tower/service.rb', line 32 def run; raise NotImplementedError; end |