Sha256: 95cbbf5b50add75adadd06223294b6d0bff84e99c0f54e15e966b9efba4dcdd3

Contents?: true

Size: 617 Bytes

Versions: 4

Compression:

Stored size: 617 Bytes

Contents

require 'simple_worker'

class TestRunner < SimpleWorker::Worker

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

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

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



end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_worker-0.0.12 test/test_runner.rb
simple_worker-0.0.10 test/test_runner.rb
simple_worker-0.0.9 test/test_runner.rb
simple_worker-0.0.8 test/test_runner.rb