class DragonSkeleton::LongCalculation::LongCalculationFiber::YieldAfterDurationStrategy

Public Class Methods

new(milliseconds) click to toggle source
# File lib/dragon_skeleton/long_calculation/long_calculation_fiber.rb, line 37
def initialize(milliseconds)
  @milliseconds = milliseconds
  @start_time = Time.now.to_f
end

Public Instance Methods

should_yield?() click to toggle source
# File lib/dragon_skeleton/long_calculation/long_calculation_fiber.rb, line 42
def should_yield?
  (Time.now.to_f - @start_time) * 1000 >= @milliseconds
end