Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/stealth/core_ext/string.rb

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#normalizeObject

Removes blank padding and double+single quotes



10
11
12
# File 'lib/stealth/core_ext/string.rb', line 10

def normalize
  self.upcase.strip
end

#without_punctuationObject



14
15
16
# File 'lib/stealth/core_ext/string.rb', line 14

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