Sha256: 73ab4d3bd35861cdcbceb57f8138abf6e4dae50e6a524957b9024af26650d8c2

Contents?: true

Size: 468 Bytes

Versions: 4

Compression:

Stored size: 468 Bytes

Contents

module Routemaster
  module Jobs
    class Job
      class << self
        def data_for(job_class, args)
          { 'class' => job_class.to_s, 'args'  => args }
        end

        def execute(job_data)
          job = create_job(job_data)
          job.new.perform(*job_data['args'])
        end

        private

        def create_job(job_data)
          job_class = job_data['class']
          Kernel.const_get(job_class)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
routemaster-drain-2.3.0 lib/routemaster/jobs/job.rb
routemaster-drain-2.2.2 lib/routemaster/jobs/job.rb
routemaster-drain-2.0.0 lib/routemaster/jobs/job.rb
routemaster-drain-1.1.0 lib/routemaster/jobs/job.rb