Method: Clearbit::Analytics::Client#initialize
- Defined in:
- lib/clearbit/analytics/client.rb
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/clearbit/analytics/client.rb', line 20 def initialize(opts = {}) symbolize_keys!(opts) @queue = Queue.new @write_key = opts[:write_key] @max_queue_size = opts[:max_queue_size] || Defaults::Queue::MAX_SIZE @worker_mutex = Mutex.new @worker = Worker.new(@queue, @write_key, opts) check_write_key! at_exit { @worker_thread && @worker_thread[:should_exit] = true } end |