Sha256: 5ce1bffa6b7cd26c639c2e96a6d675f71a30057a6e9924015d3c53e6661bcdbd

Contents?: true

Size: 391 Bytes

Versions: 10

Compression:

Stored size: 391 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)
        string.gsub(/[[:space:]]/, ' ').squeeze(' ').strip
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pupa-0.0.10 lib/pupa/processor/helper.rb
pupa-0.0.9 lib/pupa/processor/helper.rb
pupa-0.0.8 lib/pupa/processor/helper.rb
pupa-0.0.7 lib/pupa/processor/helper.rb
pupa-0.0.6 lib/pupa/processor/helper.rb
pupa-0.0.5 lib/pupa/processor/helper.rb
pupa-0.0.4 lib/pupa/processor/helper.rb
pupa-0.0.3 lib/pupa/processor/helper.rb
pupa-0.0.2 lib/pupa/processor/helper.rb
pupa-0.0.1 lib/pupa/processor/helper.rb