Method: Pry::Hackage::Hack#replace
- Defined in:
- lib/pry/hack.rb
#replace(text, hash) ⇒ String
DSL function that acts like String#sub
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/pry/hack.rb', line 120 def replace(text, hash) if hash.is_a? Hash if hash[:global?].nil? || hash[:global?] return text.gsub(@PATTERN, hash[:with]) else return text.sub(@PATTERN, hash[:with]) end else return text.gsub(@PATTERN, hash) end end |