Class: Ruckus::Mutator::Reset

Inherits:
Modifier show all
Defined in:
lib/ruckus/mutator.rb

Overview

Cache the starting value (this is meant to the be first modifier in the chain, if you’re using it) and randomly reset the string back to that starting value.

Instance Method Summary collapse

Methods inherited from Modifier

#<<, #go?

Constructor Details

#initialize(opts = {}) ⇒ Reset

Returns a new instance of Reset.



264
265
266
267
# File 'lib/ruckus/mutator.rb', line 264

def initialize(opts={})
    opts[:prob] ||= 25
    super(opts.merge(:now => true))
end

Instance Method Details

#mod(x) ⇒ Object



269
270
271
# File 'lib/ruckus/mutator.rb', line 269

def mod(x)
    (@orig ||= x.clone).clone
end