Class: Conflow::Job
- Inherits:
-
Redis::Field
- Object
- Redis::Field
- Conflow::Job
- Includes:
- Redis::Identifier, Redis::Model
- Defined in:
- lib/conflow/job.rb
Overview
Represents conflow job.
Instance Attribute Summary collapse
-
#class_name ⇒ String
Class name of the worker class.
-
#hook ⇒ String?
Name of the method on related flow to be called once job is finished.
-
#params ⇒ Hash?
Parameters needed to complete job.
-
#status ⇒ Integer
Status of the job.
Attributes included from Redis::Identifier
Attributes inherited from Redis::Field
Instance Method Summary collapse
-
#initialize ⇒ Job
constructor
Returns instance of Job.
-
#worker_type ⇒ Class
Convienience method returning Class object of the job.
Methods included from Redis::Identifier
Methods included from Redis::Model
Constructor Details
#initialize ⇒ Job
Returns instance of Job. It sets status to 0 (pending) for new jobs
25 26 27 28 |
# File 'lib/conflow/job.rb', line 25 def initialize(*) super status.default(0) end |
Instance Attribute Details
#class_name ⇒ String
Returns class name of the worker class.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/conflow/job.rb', line 14 class Job < Conflow::Redis::Field include Conflow::Redis::Model include Conflow::Redis::Identifier has_many :successors, Conflow::Job field :params, :hash field :class_name, :value field :status, :value # 0 - pending, 1 - finished field :hook, :value # Returns instance of Job. It sets status to 0 (pending) for new jobs def initialize(*) super status.default(0) end # Convienience method returning Class object of the job. # It's the class supplied in {Conflow::Flow#run} method # @return [Class] class of the job def worker_type Object.const_get(class_name.to_s) end end |
#hook ⇒ String?
Returns name of the method on related flow to be called once job is finished.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/conflow/job.rb', line 14 class Job < Conflow::Redis::Field include Conflow::Redis::Model include Conflow::Redis::Identifier has_many :successors, Conflow::Job field :params, :hash field :class_name, :value field :status, :value # 0 - pending, 1 - finished field :hook, :value # Returns instance of Job. It sets status to 0 (pending) for new jobs def initialize(*) super status.default(0) end # Convienience method returning Class object of the job. # It's the class supplied in {Conflow::Flow#run} method # @return [Class] class of the job def worker_type Object.const_get(class_name.to_s) end end |
#params ⇒ Hash?
Returns parameters needed to complete job.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/conflow/job.rb', line 14 class Job < Conflow::Redis::Field include Conflow::Redis::Model include Conflow::Redis::Identifier has_many :successors, Conflow::Job field :params, :hash field :class_name, :value field :status, :value # 0 - pending, 1 - finished field :hook, :value # Returns instance of Job. It sets status to 0 (pending) for new jobs def initialize(*) super status.default(0) end # Convienience method returning Class object of the job. # It's the class supplied in {Conflow::Flow#run} method # @return [Class] class of the job def worker_type Object.const_get(class_name.to_s) end end |
#status ⇒ Integer
Status of the job
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/conflow/job.rb', line 14 class Job < Conflow::Redis::Field include Conflow::Redis::Model include Conflow::Redis::Identifier has_many :successors, Conflow::Job field :params, :hash field :class_name, :value field :status, :value # 0 - pending, 1 - finished field :hook, :value # Returns instance of Job. It sets status to 0 (pending) for new jobs def initialize(*) super status.default(0) end # Convienience method returning Class object of the job. # It's the class supplied in {Conflow::Flow#run} method # @return [Class] class of the job def worker_type Object.const_get(class_name.to_s) end end |
Instance Method Details
#worker_type ⇒ Class
Convienience method returning Class object of the job. It’s the class supplied in Flow#run method
33 34 35 |
# File 'lib/conflow/job.rb', line 33 def worker_type Object.const_get(class_name.to_s) end |