Sha256: 18b479ee0e2757b22e1a7983139b0466b02e04e7705ed8a206b6f366df570a1e

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 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!
end

class Regexp
  # 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.2 lib/muflax/regex.rb