Sha256: 6d345d1d03915c434abab1d59436292880be876ce3e3950f5f54f045764c1688

Contents?: true

Size: 399 Bytes

Versions: 8

Compression:

Stored size: 399 Bytes

Contents

# frozen_string_literal: true

class String

  EXCLUDED_CHARS = %w[" ' . , ! ? ( ) - _ ` ‘ ’ “ ”].freeze
  EXCLUDED_CHARS_ESC = EXCLUDED_CHARS.map { |c| "\\#{c}" }
  EXCLUDED_CHARS_RE = /#{EXCLUDED_CHARS_ESC.join('|')}/

  # Removes blank padding and double+single quotes
  def normalize
    self.upcase.strip
  end

  def without_punctuation
    self.gsub(EXCLUDED_CHARS_RE, '')
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
stealth-2.0.0.beta7 lib/stealth/core_ext/string.rb
stealth-2.0.0.beta6 lib/stealth/core_ext/string.rb
stealth-2.0.0.beta5 lib/stealth/core_ext/string.rb
stealth-2.0.0.beta4 lib/stealth/core_ext/string.rb
stealth-2.0.0.beta3 lib/stealth/core_ext/string.rb
xip-2.0.0.beta2 lib/xip/core_ext/string.rb
stealth-2.0.0.beta2 lib/stealth/core_ext/string.rb
stealth-2.0.0.beta1 lib/stealth/core_ext/string.rb