Sha256: 5ad7204904636d0d034a422f236ed2f40c7b4fbbb7baf68a4319dfa4b2a834de

Contents?: true

Size: 359 Bytes

Versions: 19

Compression:

Stored size: 359 Bytes

Contents

module Krikri::Enrichments
  ##
  # Strip whitespace
  #
  #   StripWhitespace.new.enrich_value("\tmoominpapa  \t  \nmoominmama  ")
  #   # => ['moominpapa', 'moominmama']
  class StripWhitespace
    include Krikri::FieldEnrichment

    def enrich_value(value)
      return value unless value.is_a? String
      value.strip.gsub(/\s+/, ' ')
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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