Sha256: dfac37f275171ae1ca105dc8c708675a0cb080e0771f5585ed2949b1d09823e0

Contents?: true

Size: 652 Bytes

Versions: 4

Compression:

Stored size: 652 Bytes

Contents

module Greenjaguar
  module Strategies
    class WaitStrategy
      attr_accessor :time_unit

      def initialize(*args)
        @time_unit = :sec # default value is seconds
      end

      def time_unit=(value)
        @time_unit = value
        reset_vars
      end

      def wait
        raise "wait not implemented by subclass"
      end

      def reset_vars
        raise "reset_vars not implemented by subclass. This method should be implemented by subclasses to init their wait time unit"
      end

      def convert_to(time_unit)
        if time_unit == :sec
          1
        else
          0.001
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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