Class: Greenjaguar::Strategies::WaitStrategy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ WaitStrategy

Returns a new instance of WaitStrategy.



6
7
8
# File 'lib/greenjaguar/strategies/wait_strategy.rb', line 6

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

Instance Attribute Details

#time_unitObject

Returns the value of attribute time_unit.



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

def time_unit
  @time_unit
end

Instance Method Details

#convert_to(time_unit) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/greenjaguar/strategies/wait_strategy.rb', line 23

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

#reset_varsObject



19
20
21
# File 'lib/greenjaguar/strategies/wait_strategy.rb', line 19

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

#waitObject



15
16
17
# File 'lib/greenjaguar/strategies/wait_strategy.rb', line 15

def wait
  raise "wait not implemented by subclass"
end