Class: Termplot::Producers::CommandProducer
- Inherits:
-
BaseProducer
- Object
- BaseProducer
- Termplot::Producers::CommandProducer
- Defined in:
- lib/termplot/producers/command_producer.rb
Instance Method Summary collapse
Methods inherited from BaseProducer
#close, #closed?, #initialize, #register_consumer, #shift
Constructor Details
This class inherits a constructor from Termplot::Producers::BaseProducer
Instance Method Details
#run ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/termplot/producers/command_producer.rb', line 4 def run loop do n = `/bin/bash -c '#{.command}'`.chomp # TODO: Error handling... if numeric?(n) queue << n.to_f consumer&.run end # Interval is in ms sleep(.interval / 1000.0) end end |