Sha256: 23fe02afdbe6bb7ac727ab8d22241550bffc0c8ddfecadb5584f06412f567fff

Contents?: true

Size: 323 Bytes

Versions: 3

Compression:

Stored size: 323 Bytes

Contents

module Arx

  # Class for cleaning strings.
  class Cleaner

    # Cleans strings.
    # @param [String] string Removes newline/return characters and multiple spaces from a string.
    # @return [String] The cleaned string.
    def self.clean(string)
      string.gsub(/\r\n|\r|\n/, ' ').strip.squeeze ' '
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arx-0.3.0 lib/arx/cleaner.rb
arx-0.2.0 lib/arx/cleaner.rb
arx-0.1.0 lib/arx/cleaner.rb