Sha256: 19e9b48248b0a4209c3c98daf4922bd3cfbb00cf74376db2f7d0f6ffdf4bce29

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

require 'simple_worker'

# Bump for new checksum.
class TestWorker < SimpleWorker::Base

    def run(data=nil)
        log 'running the runner for leroy '.upcase + ' with data: ' + data.inspect
        @times = data["times"].to_i
        @times.times do |i|
            log 'running at ' + i.to_s
            sleep 1
            set_progress(:percent=> (i / @times * 100))
        end
    end

    def set_complete(params=nil)
        log 'SET COMPLETE YAY!' + params[:task_set_id]
    end

    def progress
        if @count
            return @count / @times
        end
        return 0.0
    end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_worker-0.1.2 test/test_worker.rb
simple_worker-0.1.1 test/test_worker.rb
simple_worker-0.1.0 test/test_worker.rb