Class: Artoo::Drivers::Counter
- Defined in:
- lib/artoo/drivers/counter.rb
Overview
Test driver to count up
Constant Summary collapse
- COMMANDS =
[:count].freeze
Instance Attribute Summary
Attributes inherited from Driver
Instance Method Summary collapse
- #count ⇒ Object
-
#start_driver ⇒ Object
Publishes events to update and alive event topics with incremental count.
Methods inherited from Driver
#command, #commands, #connection, #event_topic_name, #initialize, #interval, #known_command?, #method_missing, #pin, #require_interface
Constructor Details
This class inherits a constructor from Artoo::Drivers::Driver
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Artoo::Drivers::Driver
Instance Method Details
#count ⇒ Object
23 24 25 |
# File 'lib/artoo/drivers/counter.rb', line 23 def count @count end |
#start_driver ⇒ Object
Publishes events to update and alive event topics with incremental count
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/artoo/drivers/counter.rb', line 12 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 |