Sha256: 512a58da8e42a27e46a36e3ae3ceafde0813789e06d6c2771eaf38283357bde4

Contents?: true

Size: 535 Bytes

Versions: 4

Compression:

Stored size: 535 Bytes

Contents

module Greenjaguar
  module Strategies
    class FibonacciStrategy < WaitStrategy
      def initialize
        super
        @prev_time_to_wait = 1
        @time_to_wait = @prev_time_to_wait
      end

      def reset_vars
        @prev_time_to_wait = 1 * convert_to(time_unit)
        @time_to_wait = @prev_time_to_wait
      end

      def wait
        sleep @time_to_wait
        new_time = @prev_time_to_wait + @time_to_wait
        @prev_time_to_wait = @time_to_wait
        @time_to_wait = new_time
      end
    end
  end
end


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
greenjaguar-0.0.6 lib/greenjaguar/strategies/fibonacci_strategy.rb
greenjaguar-0.0.5 lib/greenjaguar/strategies/fibonacci_strategy.rb
greenjaguar-0.0.4 lib/greenjaguar/strategies/fibonacci_strategy.rb
greenjaguar-0.0.3 lib/greenjaguar/strategies/fibonacci_strategy.rb