Class: Twitchus::Worker
- Inherits:
-
Object
- Object
- Twitchus::Worker
- Defined in:
- lib/twitchus/worker.rb
Instance Method Summary collapse
-
#initialize(config_file) ⇒ Worker
constructor
A new instance of Worker.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/twitchus/worker.rb', line 10 def run @storage = Twitchus::Storage.new(@config.host, @config.port, @config.key) # Since this can run periodically, clean the list first @storage.clear online_streams = @checker.fetch_all(@config.streams) online_streams.each do |data| channel = data["channel"] data = { title: channel["status"], name: channel["name"], image: channel["video_banner"], preview: data["preview"] } @storage.push data.to_json end end |