Sha256: 6855b3cebec71f176d1057336a3317bc3b58ad1b2d003762291118b55bd3ee6f

Contents?: true

Size: 435 Bytes

Versions: 2

Compression:

Stored size: 435 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module UnicodeTools
  module StringExt
    module Base
      def has_whitespace?
        !!(self =~ WHITESPACE_REGEX)
      end

      def replace_whitespace(replacement = nil, &block)
        gsub(WHITESPACE_REGEX, replacement, &block)
      end

      def replace_whitespace!(replacement = nil, &block)
        gsub!(WHITESPACE_REGEX, replacement, &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unicode-tools-1.0.2 lib/unicode-tools/string_ext/base.rb
unicode-tools-1.0.1 lib/unicode-tools/string_ext/base.rb