Class: Greenjaguar::Strategies::RandomStrategy

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

Instance Attribute Summary

Attributes inherited from WaitStrategy

#time_unit

Instance Method Summary collapse

Methods inherited from WaitStrategy

#convert_to

Constructor Details

#initializeRandomStrategy

Returns a new instance of RandomStrategy.



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

def initialize
  super
  @time_to_wait = 5
end

Instance Method Details

#reset_varsObject



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

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

#waitObject



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

def wait
  rand(@time_to_wait)
end