I was wondering if there is a simple way to do every combination of selected character substitutions in ruby in a simple way.
An example:
string
string = "this is a test" subs = ['a'=>'@','i'=>'!','s'=>'$'] subs = subs.first.map(&:to_a) 1.upto(subs.length).each do |n| subs.combination(n).each do |a| p a.each_with_object(string.dup){|pair, s| s.gsub!(*pair)} end end