Class: Datadog::Worker
- Inherits:
 - 
      Object
      
        
- Object
 - Datadog::Worker
 
 
- Defined in:
 - lib/ddtrace/worker.rb
 
Overview
Base class for work tasks
Direct Known Subclasses
Profiling::Collectors::Stack, Profiling::Scheduler, Datadog::Workers::RuntimeMetrics, Datadog::Workers::TraceWriter
Instance Attribute Summary collapse
- 
  
    
      #task  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute task.
 
Instance Method Summary collapse
- 
  
    
      #initialize(&block)  ⇒ Worker 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Worker.
 - #perform(*args) ⇒ Object
 
Constructor Details
#initialize(&block) ⇒ Worker
Returns a new instance of Worker.
      8 9 10  | 
    
      # File 'lib/ddtrace/worker.rb', line 8 def initialize(&block) @task = block end  | 
  
Instance Attribute Details
#task ⇒ Object
Returns the value of attribute task.
      5 6 7  | 
    
      # File 'lib/ddtrace/worker.rb', line 5 def task @task end  | 
  
Instance Method Details
#perform(*args) ⇒ Object
      12 13 14  | 
    
      # File 'lib/ddtrace/worker.rb', line 12 def perform(*args) task.call(*args) unless task.nil? end  |