Sha256: 31b71901049727593385c9c343364bee13e7ab231e99ee9ec5ef11f29b3482a5
Contents?: true
Size: 434 Bytes
Versions: 126
Compression:
Stored size: 434 Bytes
Contents
# frozen_string_literal: true class ReeString::Remove include Ree::FnDSL fn :remove doc(<<~DOC) Alters the string by removing all occurrences of the patterns. remove("foo bar test", [" test", /bar/]) # => "foo " DOC contract(String, ArrayOf[Or[String, Regexp]] => String) def call(str, patterns) str = str.dup patterns.each do |pattern| str.gsub!(pattern, "") end str end end
Version data entries
126 entries across 126 versions & 1 rubygems