Sha256: 2449f6fd27e4c25b1230df7d154195220ff78989f403091912093c6d1b8ff80d

Contents?: true

Size: 547 Bytes

Versions: 27

Compression:

Stored size: 547 Bytes

Contents

require 'artoo/drivers/driver'

module Artoo
  module Drivers
    # Test driver to count up
    class Counter < Driver

      COMMANDS = [:count].freeze

      # Publishes events to update and alive event topics
      # with incremental count
      def start_driver
        @count = 0
        every(interval) do
          @count += 1
          publish(event_topic_name("update"), "count", @count)
          publish(event_topic_name("count"), @count)
        end

        super
      end

      def count
        @count
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
artoo-1.8.2 lib/artoo/drivers/counter.rb
artoo-1.8.1 lib/artoo/drivers/counter.rb
artoo-1.8.0 lib/artoo/drivers/counter.rb
artoo-1.6.7 lib/artoo/drivers/counter.rb
artoo-1.6.6 lib/artoo/drivers/counter.rb
artoo-1.6.5 lib/artoo/drivers/counter.rb
artoo-1.6.4 lib/artoo/drivers/counter.rb
artoo-1.6.3 lib/artoo/drivers/counter.rb
artoo-1.6.2 lib/artoo/drivers/counter.rb
artoo-1.6.1 lib/artoo/drivers/counter.rb
artoo-1.6.0 lib/artoo/drivers/counter.rb
artoo-1.5.0 lib/artoo/drivers/counter.rb
artoo-1.4.1 lib/artoo/drivers/counter.rb
artoo-1.4.0 lib/artoo/drivers/counter.rb
artoo-1.3.0 lib/artoo/drivers/counter.rb
artoo-1.2.2 lib/artoo/drivers/counter.rb
artoo-1.2.1 lib/artoo/drivers/counter.rb
artoo-1.2.0 lib/artoo/drivers/counter.rb
artoo-1.1.1 lib/artoo/drivers/counter.rb
artoo-1.1.0 lib/artoo/drivers/counter.rb