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

- old
+ new

@@ -6,14 +6,16 @@ class FlashFactory < Factory #The number of times to return a value before switching. attr_accessor :interval - def initialize(interval = 3) + #Takes a hash with all keys supported by Factory, plus these keys and defaults: + # :interval => 3 + def initialize(options = {}) super @counters = {} @values = {} - @interval = interval + @interval = options[:interval] || 3 end #If key is over threshold, flip to other value and reset counter. def get_unit(key) @counters[key] ||= 0 \ No newline at end of file