Sha256: 6419c88089cbe3a69f50f26c65a99be939eb8c73c7dcbf62f7102f462b5e7b46

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 Bytes

Contents

require 'headsail/task'

module Headsail
  # The main event loop for retrieving data from APIS
  #
  class Client
    def initialize(configure)
      @configure = configure
      @threads = []
      @tasks = []
      setup_tasks
    end

    def run
      @tasks.each { |task| @threads << task.run }
      @threads.map(&:execute)
      loop { sleep 300 }
    end

    private

    def setup_tasks
      @configure.apis.each { |api| @tasks << Task.new(api) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
headsail-0.1.11 lib/headsail/client.rb
headsail-0.1.1 lib/headsail/client.rb
headsail-0.1.0 lib/headsail/client.rb