class ExcessFlow::Strategy
ExcessFlow::Strategy
¶ ↑
Base class for implementing different strategies for rate limiting.
Attributes
configuration[R]
Public Class Methods
execute(configuration:, &block)
click to toggle source
# File lib/excess_flow/strategy.rb, line 24 def self.execute(configuration:, &block) new(configuration).execute(&block) end
new(configuration)
click to toggle source
# File lib/excess_flow/strategy.rb, line 28 def initialize(configuration) @configuration = configuration end
Public Instance Methods
execute() { || ... }
click to toggle source
# File lib/excess_flow/strategy.rb, line 32 def execute result = if within_rate_limit? yield else FailedExecution.new end RateLimitedExecutionResult.new(result) end
within_rate_limit?()
click to toggle source
# File lib/excess_flow/strategy.rb, line 42 def within_rate_limit? true end