Module: CliTrivia::Filter
- Included in:
- Question
- Defined in:
- lib/concerns/filter.rb
Instance Method Summary collapse
-
#format_string(fsg) ⇒ Object
A method available to all classes that passes in a string and replaces unreadable characters with escaped punctuation.
Instance Method Details
#format_string(fsg) ⇒ Object
A method available to all classes that passes in a string and replaces unreadable characters with escaped punctuation. Used by question text and answers.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/concerns/filter.rb', line 5 def format_string(fsg) fsg = fsg.gsub(/"/, "'") fsg = fsg.gsub(/&/, '&') fsg = fsg.gsub(/ò/, 'o') fsg = fsg.gsub(/ö/, 'o') fsg = fsg.gsub(/ó/, 'o') fsg = fsg.gsub(/ã/, 'a') fsg = fsg.gsub(/ü/, 'u') fsg = fsg.gsub(/Ö/, 'O') fsg = fsg.gsub(/′/, "'") fsg = fsg.gsub(/″/, '"') fsg = fsg.gsub(/í/, 'i') fsg = fsg.gsub(/á/, 'a') fsg = fsg.gsub(/é/, 'e') fsg = fsg.gsub(/'/, "'") fsg = fsg.gsub(/“/, '"') fsg = fsg.gsub(/”/, '"') fsg = fsg.gsub(/’/, "'") fsg = fsg.gsub(/‘/, "'") fsg = fsg.gsub(/ñ/, 'n') fsg = fsg.gsub(/‎/, '') fsg end |