Sha256: 8b9a83beecdfa198a4688474d480cf67f5f92dd2da0f566e20cf88213114d436

Contents?: true

Size: 431 Bytes

Versions: 3

Compression:

Stored size: 431 Bytes

Contents

#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
# Copyright Freya Dorn <freya.siv.dorn@gmail.com>, 2013
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
muflax-0.7.0 lib/muflax/regex.rb
muflax-0.6.1 lib/muflax/regex.rb
muflax-0.6.0 lib/muflax/regex.rb