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

- old
+ new

@@ -6,12 +6,14 @@ class SkipFactory < Factory #The percentage odds that the factory will return 0 instead of 1. attr_accessor :odds - def initialize(odds = 0.1) + #Takes a hash with all keys supported by Factory, plus these keys and defaults: + # :odds => 0.1 + def initialize(options = {}) super - @odds = odds + @odds = options[:odds] || 0.1 end #If a random number between 0 and 1 is less than the assigned odds value, will return 0 (a "skip"). #Otherwise returns 1. def get_unit(key) \ No newline at end of file