Class: Greenjaguar::Strategies::FixedIntervalStrategy

Inherits:
WaitStrategy
  • Object
show all
Defined in:
lib/greenjaguar/strategies/fixed_interval_strategy.rb

Instance Attribute Summary

Attributes inherited from WaitStrategy

#time_unit

Instance Method Summary collapse

Methods inherited from WaitStrategy

#convert_to

Constructor Details

#initialize(*args) ⇒ FixedIntervalStrategy

Returns a new instance of FixedIntervalStrategy.



4
5
6
7
# File 'lib/greenjaguar/strategies/fixed_interval_strategy.rb', line 4

def initialize(*args)
  super
  @time_to_wait = args[0]
end

Instance Method Details

#reset_varsObject



9
10
11
# File 'lib/greenjaguar/strategies/fixed_interval_strategy.rb', line 9

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

#waitObject



13
14
15
# File 'lib/greenjaguar/strategies/fixed_interval_strategy.rb', line 13

def wait
  sleep @time_to_wait
end