Module: Textpants
- Defined in:
- lib/textpants.rb,
lib/textpants/version.rb
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
Class Method Details
.normalize(input) ⇒ Object
10 11 12 |
# File 'lib/textpants.rb', line 10 def normalize(input) NKF.nkf('-WwZ0Z1Xm0', sanitize(input)) end |
.sanitize(input) ⇒ Object
6 7 8 |
# File 'lib/textpants.rb', line 6 def sanitize(input) NKF.nkf('-WwLum0', input.to_s.scrub('?').gsub(/[\u0000-\u0008\u000E-\u001F\u007F]/, '')) end |
.squish(input) ⇒ Object
14 15 16 |
# File 'lib/textpants.rb', line 14 def squish(input) normalize(input).gsub(/[\s\p{Cf}\p{Zs}\p{Zp}\p{Zl}]+/, ' ').strip end |