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

- old
+ new

@@ -6,13 +6,15 @@ class SineFactory < Factory #Counters used to calculate sine values will be incremented by this amount with each query. attr_accessor :interval - def initialize(interval = 0.1) + #Takes a hash with all keys supported by Factory, plus these keys and defaults: + # :interval => 0.1 + def initialize(options = {}) super @counters = {} - @interval = interval + @interval = options[:interval] || 0.1 end #Increment counter for key and get its sine, then scale it between 0 and 1. def get_unit(key) @counters[key] ||= 0 \ No newline at end of file