Module: Pedantic::Emphasis
- Included in:
- Pedantic
- Defined in:
- lib/pedantic/emphasis.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
2 3 4 |
# File 'lib/pedantic/emphasis.rb', line 2 def self.included(base) base.processors :fix_emphasis end |
Instance Method Details
#fix_emphasis(string) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pedantic/emphasis.rb', line 6 def fix_emphasis(string) { /\bso+\b/ => 'so', /\bre+a+ll+y\b/i => 'really', /\boka+y\b/i => 'okay', /\boo+h\b/i => 'ooh', /\bthe shit\b/i => 'fantastic' }.each { |pattern, replacement| string.gsub!(pattern, replacement) } string end |