Class: Remi::Job::SubJob
- Inherits:
-
Object
- Object
- Remi::Job::SubJob
- Defined in:
- lib/remi/job/sub_job.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #dsl_return ⇒ Object
- #execute ⇒ Object
- #execute_transforms ⇒ Object
- #fields(data_subject) ⇒ Object
-
#initialize(context = nil, name: 'UNDEFINED SubJob', **kargs, &block) ⇒ SubJob
constructor
A new instance of SubJob.
- #job ⇒ Object
Constructor Details
#initialize(context = nil, name: 'UNDEFINED SubJob', **kargs, &block) ⇒ SubJob
Returns a new instance of SubJob.
4 5 6 7 8 |
# File 'lib/remi/job/sub_job.rb', line 4 def initialize(context=nil, name: 'UNDEFINED SubJob', **kargs, &block) @context = context @name = name @block = block end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
10 11 12 |
# File 'lib/remi/job/sub_job.rb', line 10 def context @context end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/remi/job/sub_job.rb', line 10 def name @name end |
Instance Method Details
#dsl_return ⇒ Object
12 13 14 15 16 |
# File 'lib/remi/job/sub_job.rb', line 12 def dsl_return sub_job = Dsl.dsl_return(self, @context, &@block) raise ArgumentError, "SubJob DSL must return a Remi::Job" unless sub_job.is_a? Job sub_job end |
#execute ⇒ Object
26 27 28 |
# File 'lib/remi/job/sub_job.rb', line 26 def execute job.execute end |
#execute_transforms ⇒ Object
30 31 32 |
# File 'lib/remi/job/sub_job.rb', line 30 def execute_transforms job.execute(:transforms) end |
#fields(data_subject) ⇒ Object
22 23 24 |
# File 'lib/remi/job/sub_job.rb', line 22 def fields(data_subject) job.send(data_subject).dsl_eval.fields end |
#job ⇒ Object
18 19 20 |
# File 'lib/remi/job/sub_job.rb', line 18 def job @job ||= dsl_return end |