Sha256: 2cdef8682339a1190ffb27a066b79948ac59e0338352d0fb345e8a22c70a8533

Contents?: true

Size: 630 Bytes

Versions: 5

Compression:

Stored size: 630 Bytes

Contents

require 'simple_worker'

class TestRunner

    include 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

5 entries across 5 versions & 1 rubygems

Version Path
simple_worker-0.0.7 test/test_runner.rb
simple_worker-0.0.6 test/test_runner.rb
simple_worker-0.0.5 test/test_runner.rb
simple_worker-0.0.4 test/test_runner.rb
simple_worker-0.0.3 test/test_runner.rb