Class: Hypernova::Batch
- Inherits:
-
Object
- Object
- Hypernova::Batch
- Extended by:
- Forwardable
- Defined in:
- lib/hypernova/batch.rb
Instance Attribute Summary collapse
-
#jobs ⇒ Object
readonly
Returns the value of attribute jobs.
-
#service ⇒ Object
writeonly
Sets the attribute service.
Instance Method Summary collapse
-
#initialize(service) ⇒ Batch
constructor
- The only requirement for the ‘service` object is the method render_react_batch which should accept a Hash of { job_token
- Scalar => job_data
-
Hash } the subscript operator, to access result via tokens.
- #render(job) ⇒ Object
- #submit! ⇒ Object
- #submit_fallback! ⇒ Object
Constructor Details
#initialize(service) ⇒ Batch
The only requirement for the ‘service` object is the method render_react_batch
- which should accept a Hash of { job_token
- Scalar => job_data
-
Hash }
the subscript operator, to access result via tokens
17 18 19 20 21 |
# File 'lib/hypernova/batch.rb', line 17 def initialize(service) # TODO: make hashmap instead???? @jobs = [] @service = service end |
Instance Attribute Details
#jobs ⇒ Object (readonly)
Returns the value of attribute jobs.
8 9 10 |
# File 'lib/hypernova/batch.rb', line 8 def jobs @jobs end |
#service=(value) ⇒ Object
Sets the attribute service
7 8 9 |
# File 'lib/hypernova/batch.rb', line 7 def service=(value) @service = value end |
Instance Method Details
#render(job) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/hypernova/batch.rb', line 23 def render(job) Hypernova.verify_job_shape(job) token = jobs.length jobs << job token.to_s end |
#submit! ⇒ Object
30 31 32 |
# File 'lib/hypernova/batch.rb', line 30 def submit! service.render_batch(jobs_hash) end |
#submit_fallback! ⇒ Object
34 35 36 |
# File 'lib/hypernova/batch.rb', line 34 def submit_fallback! service.render_batch_blank(jobs_hash) end |