Sha256: 3b218d37a663c9cdc5b039932566830b8a5adc92d95776fe51df8dec7735ef3c

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
# Copyright muflax <mail@muflax.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!

  # ruby 2.3 compat
  def match?(string, pos = 0)
    !!match(string, pos)
  end unless //.respond_to?(:match?)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
muflax-0.3.1 lib/muflax/regex.rb