Sha256: feb8c91d44c3ab8e6a593c0ac7960253e2ef26e02ae8f5b169cb103b4525d2d7

Contents?: true

Size: 423 Bytes

Versions: 20

Compression:

Stored size: 423 Bytes

Contents

module Pupa
  class Processor
    # Processor helper methods.
    module Helper
      # Normalizes all whitespace to spaces, removes consecutive spaces, and
      # strips leading and ending spaces.
      #
      # @param [String] a string
      # @return [String] a clean string
      def clean(string)
        if string
          string.gsub(/[[:space:]]/, ' ').squeeze(' ').strip
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pupa-0.2.4 lib/pupa/processor/helper.rb
pupa-0.2.3 lib/pupa/processor/helper.rb
pupa-0.2.2 lib/pupa/processor/helper.rb
pupa-0.2.1 lib/pupa/processor/helper.rb
pupa-0.2.0 lib/pupa/processor/helper.rb
pupa-0.1.11 lib/pupa/processor/helper.rb
pupa-0.1.10 lib/pupa/processor/helper.rb
pupa-0.1.9 lib/pupa/processor/helper.rb
pupa-0.1.8 lib/pupa/processor/helper.rb
pupa-0.1.7 lib/pupa/processor/helper.rb
pupa-0.1.6 lib/pupa/processor/helper.rb
pupa-0.1.5 lib/pupa/processor/helper.rb
pupa-0.1.4 lib/pupa/processor/helper.rb
pupa-0.1.3 lib/pupa/processor/helper.rb
pupa-0.1.2 lib/pupa/processor/helper.rb
pupa-0.1.1 lib/pupa/processor/helper.rb
pupa-0.1.0 lib/pupa/processor/helper.rb
pupa-0.0.13 lib/pupa/processor/helper.rb
pupa-0.0.12 lib/pupa/processor/helper.rb
pupa-0.0.11 lib/pupa/processor/helper.rb