Class: Nightwing::Sidekiq::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/nightwing/sidekiq/base.rb

Direct Known Subclasses

Profiler, QueueStats, Stats, WorkerStats

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
# File 'lib/nightwing/sidekiq/base.rb', line 11

def initialize(options = {})
  @namespace = options.fetch(:namespace, "sidekiq")
  @client = options.fetch(:client, Nightwing.client)
  @logger = options.fetch(:logger, Nightwing::Logger.new)
  @debug = options.fetch(:debug, false)
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



9
10
11
# File 'lib/nightwing/sidekiq/base.rb', line 9

def logger
  @logger
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



9
10
11
# File 'lib/nightwing/sidekiq/base.rb', line 9

def namespace
  @namespace
end

Instance Method Details

#clientObject



18
19
20
21
22
23
24
25
26
# File 'lib/nightwing/sidekiq/base.rb', line 18

def client
  @client_proxy ||= begin
    if @debug
      Nightwing::ClientLogger.new(client: @client, logger: @logger)
    else
      @client
    end
  end
end