Method: Rodbot::Refinements#psub
- Defined in:
- lib/rodbot/refinements.rb
#psub ⇒ String
Replace placeholders
Placeholders are all UPCASE and wrapped in [[ and ]]. They must match keys in the placeholder hash, however, these keys are Symbols and all downcase.
100 101 102 103 104 |
# File 'lib/rodbot/refinements.rb', line 100 refine String do def psub(placeholders) self.gsub(/\[\[.*?\]\]/) { placeholders[_1[2..-3].downcase.to_sym] } end end |