lib/greenjaguar/policy_builder.rb in greenjaguar-0.0.5 vs lib/greenjaguar/policy_builder.rb in greenjaguar-0.0.6

- old
+ new

@@ -1,8 +1,8 @@ module Greenjaguar class PolicyBuilder - attr_accessor :count, :wait_strategy, :timeout, :logger, :strategy, :exceptions + attr_accessor :count, :wait_strategy, :timeout, :logger, :exceptions def initialize(&block) @count = 1 @timeout = 300 @exceptions = [] @@ -39,11 +39,11 @@ def never_give_up? @count == -1 end def measure_time_in(time_unit) - @strategy.time_unit = time_unit + strategy.time_unit = time_unit self end def with_strategy(wait_strategy, *args) @strategy = init_wait_strategy(wait_strategy, *args) @@ -65,14 +65,14 @@ def wait strategy.wait end - private - def strategy @strategy ||= init_wait_strategy(:default) end + + private def init_wait_strategy(wait_strategy, *args) case wait_strategy when :fibonacci return Greenjaguar::Strategies::FibonacciStrategy.new \ No newline at end of file