Sha256: c0f58967018dc8b3726db4bcf6ebc12f9f1c8d81ef0fc3cb4cc64211090d3f12

Contents?: true

Size: 379 Bytes

Versions: 19

Compression:

Stored size: 379 Bytes

Contents

module Krikri::Enrichments
  ##
  # Strip punctuation
  #
  #   StripPunctuation.new.enrich_value("\tmo!ominpa)(pa  \n .$%^ moominmama  ")
  #   # => "\tmoominpapa  \n  moominmama  "
  class StripPunctuation
    include Krikri::FieldEnrichment

    def enrich_value(value)
      return value unless value.is_a? String
      value.gsub(/[^\p{Alnum}\'\"\s]/, '')
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
krikri-0.6.0 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.7 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.6 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.5 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.4 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.3 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.2 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.1 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.5.0 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.4.0 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.3.3 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.3.2 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.3.1 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.2.1 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.2.0 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.1.3 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.1.2 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.1.1 lib/krikri/enrichments/strip_punctuation.rb
krikri-0.1.0 lib/krikri/enrichments/strip_punctuation.rb