Class: ExcessFlow::ThrottledExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/excess_flow/throttled_executor.rb

Overview

ExcessFlow::ThrottledExecutor

Wrapper service class that will take care of initialization of configuration object and will execute on correct throttling strategy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ ThrottledExecutor

Returns a new instance of ThrottledExecutor.



29
30
31
# File 'lib/excess_flow/throttled_executor.rb', line 29

def initialize(args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



23
24
25
# File 'lib/excess_flow/throttled_executor.rb', line 23

def args
  @args
end

Class Method Details

.select_strategy_and_execute(args, &block) ⇒ Object



25
26
27
# File 'lib/excess_flow/throttled_executor.rb', line 25

def self.select_strategy_and_execute(args, &block)
  new(args).select_strategy_and_execute(&block)
end

Instance Method Details

#select_strategy_and_execute(&block) ⇒ Object



33
34
35
# File 'lib/excess_flow/throttled_executor.rb', line 33

def select_strategy_and_execute(&block)
  strategy.execute(configuration: configuration, &block)
end