Class: Krikri::Enrichments::StripPunctuation
- Inherits:
-
Object
- Object
- Krikri::Enrichments::StripPunctuation
- Includes:
- FieldEnrichment
- Defined in:
- lib/krikri/enrichments/strip_punctuation.rb
Overview
Strip punctuation
StripPunctuation.new.enrich_value("\tmo!ominpa)(pa \n .$%^ moominmama ")
# => "\tmoominpapa \n moominmama "
Constant Summary
Constants included from SoftwareAgent
Instance Method Summary collapse
Methods included from FieldEnrichment
#enrich, #enrich_all, #enrich_field
Methods included from Krikri::Enrichment
#enrich, #enrich!, #list_fields
Methods included from SoftwareAgent
Instance Method Details
#enrich_value(value) ⇒ Object
10 11 12 13 |
# File 'lib/krikri/enrichments/strip_punctuation.rb', line 10 def enrich_value(value) return value unless value.is_a? String value.gsub(/[^\p{Alnum}\'\"\s]/, '') end |