lib/rubyonacid/factories/increment.rb in rubyonacid-0.3.1 vs lib/rubyonacid/factories/increment.rb in rubyonacid-0.4.0

- old
+ new

@@ -11,14 +11,16 @@ @interval = value @start_value = (@interval < 0.0 ? 1.0 : 0.0) @counters.each_key{|k| @counters[k] = @start_value} end - def initialize(interval = 0.001) + #Takes a hash with all keys supported by Factory, plus these keys and defaults: + # :interval => 0.001 + def initialize(options = {}) super @start_value = 0.0 @counters = {} - @interval = interval + @interval = options[:interval] || 0.001 end #Increment counter for given key and return it. Constrain between 0 and 1. def get_unit(key) @counters[key] ||= @start_value \ No newline at end of file