Sha256: 801776e34393734575f4249674c26e120f68e12a2356e769c0f8f9d0ac86d487

Contents?: true

Size: 598 Bytes

Versions: 4

Compression:

Stored size: 598 Bytes

Contents

# encoding: utf-8

begin
  require 'celluloid/current'
rescue LoadError
  require 'celluloid'
end

require 'logger'
require 'say_when/poller/base_poller'

module SayWhen
  module Poller
    class CelluloidPoller
      include Celluloid
      include SayWhen::Poller::BasePoller

      def initialize(tick = nil)
        @tick_length = tick.to_i if tick
        start
      end

      def start
        @tick_timer = every(tick_length) { process_jobs }
      end

      def stop
        if @tick_timer
          @tick_timer.cancel
          @tick_timer = nil
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
say_when-2.2.2 lib/say_when/poller/celluloid_poller.rb
say_when-2.2.1 lib/say_when/poller/celluloid_poller.rb
say_when-2.2.0 lib/say_when/poller/celluloid_poller.rb
say_when-2.1.1 lib/say_when/poller/celluloid_poller.rb