Sha256: ef4de2caed021b64a3c3c54ca4e15df5b294e16211c310a42b3621469a0a90a6
Contents?: true
Size: 571 Bytes
Versions: 7
Compression:
Stored size: 571 Bytes
Contents
module Krikri::Enrichments ## # Strip ending punctuation # # StripEndingPunctuation.new # .enrich_value("moomin!...!;,.",) # # => "moomin" # # Leaves quotation marks and closing parentheses & brackets. Also # leaves periods when they follow a one or two letter abbreviation. class StripEndingPunctuation include Audumbla::FieldEnrichment def enrich_value(value) return value unless value.is_a? String value.gsub!(/[^\p{Alnum}\'\"\)\]\}]*$/, '') unless value.match /\s*[a-z]{1,2}\.$/i value end end end
Version data entries
7 entries across 7 versions & 1 rubygems