Method: String#change
- Defined in:
- lib/mini_sanity/change.rb
#change(pattern, replacement) ⇒ String #change(pattern, hash) ⇒ String #change(pattern) {|match| ... } ⇒ String
Like String#sub, but raises an exception if no substitution is performed.
103 104 105 |
# File 'lib/mini_sanity/change.rb', line 103 def change(pattern, replacement = nil, &block) self.dup.change!(pattern, replacement, &block) end |