lib/footing/extensions/string.rb in footing-0.1.8 vs lib/footing/extensions/string.rb in footing-0.1.9

- old
+ new

@@ -20,11 +20,10 @@ opts[:reject] ||= [] opts[:reject] = opts[:reject].map { |c| c.to_s } (1..length).map{ |i| (chars - opts[:reject]).sample }.join end - # Escapes a series of chars in the current string. - # NOTE: A new string is returned. + # Escapes a series of chars. def escape(*chars) gsub(/(?<!\\)(#{chars.join("|")})/) do |char| "\\" + char end end