Class: Termplot::Producers::StdinProducer

Inherits:
BaseProducer show all
Defined in:
lib/termplot/producers/stdin_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

#runObject



4
5
6
7
8
9
10
11
# File 'lib/termplot/producers/stdin_producer.rb', line 4

def run
  while n = STDIN.gets&.chomp do
    if numeric?(n)
      queue << n.to_f
      consumer&.run
    end
  end
end