Class: Resque::Reports::ReportJob
- Inherits:
-
Object
- Object
- Resque::Reports::ReportJob
- Includes:
- Integration
- Defined in:
- app/jobs/resque/reports/report_job.rb
Overview
ReportJob accepts report_type, its arguments in json and building report in background @example:
ReportJob.enqueue('Resque::Reports::MyReport', [1, 2].to_json)
Class Method Summary collapse
-
.execute(report_type, args_json) ⇒ Object
resque-integration main job method.
Class Method Details
.execute(report_type, args_json) ⇒ Object
resque-integration main job method
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/jobs/resque/reports/report_job.rb', line 22 def self.execute(report_type, args_json) report_class = report_type.constantize # избавиться от ActiveSupport unless report_class < BaseReport fail "Supports only successors of BaseReport, but got #{report_class}" end fail 'Report queue is not specified' unless report_class.job_queue queue report_class.job_queue args = JSON.parse(args_json) force = args.pop init_report(report_class, args) .build(force) end |