#!/usr/bin/env ruby # -*- encoding: utf-8 -*- # Copyright muflax , 2013 # License: GNU GPL 3 class String def mgsub replacements={} str = self.dup str.mgsub! replacements str end alias :gsub_all :mgsub def mgsub! replacements={} replacements.each do |a, b| self.gsub! a, b end self end alias :gsub_all! :mgsub! end class Regexp # ruby 2.3 compat def match?(string, pos = 0) !!match(string, pos) end unless //.respond_to?(:match?) end