Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/scrub_rb/monkey_patch.rb

Overview

Have to explicitly require this file to get the monkey patching of String#scrub in there, this file won’t and shouldn’t be ‘require’d in automatically.

However if there’s already a String#scrub defiend, requiring this file will do nothing.

Instance Method Summary collapse

Instance Method Details

#scrub(replacement = nil, &block) ⇒ Object



11
12
13
# File 'lib/scrub_rb/monkey_patch.rb', line 11

def scrub(replacement=nil, &block)
  ScrubRb.scrub(self, replacement, &block)
end

#scrub!(*args) ⇒ Object



15
16
17
# File 'lib/scrub_rb/monkey_patch.rb', line 15

def scrub!(*args)
  self.replace( self.scrub(*args) )
end