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

- old
+ new

@@ -10,13 +10,15 @@ def interval=(value) raise "assigned #{value} to interval, must be between -1 and 1" if value < -1 or value > 1 @interval = value end - def initialize(interval = 0.01) + #Takes a hash with all keys supported by Factory, plus these keys and defaults: + # :interval => 0.01 + def initialize(options = {}) super @counters = {} - @interval = interval + self.interval = options[:interval] || 0.01 end #Increment counter for key, looping it around to opposite side if it exits boundary. def get_unit(key) @counters[key] ||= 0 \ No newline at end of file