Class: String

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

Instance Method Summary collapse

Instance Method Details

#sentence_caseObject



7
8
9
# File 'lib/overrides/string.rb', line 7

def sentence_case
  self.split('.').first.gsub(/\W/, ' ').split(/(\A[\d]*[^a-zA-Z])/).last
end

#shell_escapeObject



11
12
13
# File 'lib/overrides/string.rb', line 11

def shell_escape
  %Q{"#{self}"}
end

#titleizeObject



3
4
5
# File 'lib/overrides/string.rb', line 3

def titleize
  self.split.each { |x| x.capitalize! }.join(' ')
end