Class: MSG_Chumby::RandomReadingImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/msg-chumby-daemon/reading-importer.rb

Overview

Generates random readings for standalone demos.

Instance Method Summary collapse

Constructor Details

#initialize(reading_cache, max_reading) ⇒ RandomReadingImporter

Returns a new instance of RandomReadingImporter.



11
12
13
14
# File 'lib/msg-chumby-daemon/reading-importer.rb', line 11

def initialize(reading_cache, max_reading)
  @reading_cache=reading_cache
  @max_reading=max_reading
end

Instance Method Details

#doWorkObject



15
16
17
18
19
20
# File 'lib/msg-chumby-daemon/reading-importer.rb', line 15

def doWork
  value=rand(@max_reading)
  reading=Flukso::UTCReading.new(Time.now.to_i, value)
  #puts "generated random reading #{reading}"
  @reading_cache.update_last_reading(reading);
end