Sha256: 254d1de306c7da70f77326ba5b7a8a5017b4342b4b39ee717048eb88bcc77854

Contents?: true

Size: 710 Bytes

Versions: 8

Compression:

Stored size: 710 Bytes

Contents

# encoding: utf-8

require 'say_when/poller/base_poller'

module SayWhen
  module Poller
    class SimplePoller
      include SayWhen::Poller::BasePoller

      attr_accessor :running

      def initialize(tick = nil)
        self.tick_length = tick.to_i if tick
        self.running = false
      end

      def running?
        !!running
      end

      def start
        self.running = true
        logger.info "SayWhen::SimplePoller started"
        while running
          process_jobs
          tick
        end
        logger.info "SayWhen::SimplePoller stopped"
      end

      def stop
        logger.info "SayWhen::SimplePoller stopping..."
        self.running = false
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
say_when-2.2.2 lib/say_when/poller/simple_poller.rb
say_when-2.2.1 lib/say_when/poller/simple_poller.rb
say_when-2.2.0 lib/say_when/poller/simple_poller.rb
say_when-2.1.1 lib/say_when/poller/simple_poller.rb
say_when-2.1.0 lib/say_when/poller/simple_poller.rb
say_when-2.0.2 lib/say_when/poller/simple_poller.rb
say_when-2.0.1 lib/say_when/poller/simple_poller.rb
say_when-2.0.0 lib/say_when/poller/simple_poller.rb