Sha256: 0ff63b73c96c0a4f749fb55400e719f9b26ae3bdd4770685f7efaffc80e93aea
Contents?: true
Size: 569 Bytes
Versions: 10
Compression:
Stored size: 569 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 Krikri::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
10 entries across 10 versions & 1 rubygems