Module: StringExtensions

Included in:
String
Defined in:
lib/cuporter/extensions/string.rb

Overview

Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License

Constant Summary collapse

APOSTROPHE =
"\047"
APOS_ENTITY =
"'"

Instance Method Summary collapse

Instance Method Details

#escape_apostropheObject



9
10
11
# File 'lib/cuporter/extensions/string.rb', line 9

def escape_apostrophe
  gsub(APOSTROPHE, APOS_ENTITY)
end

#to_class_nameObject



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

def to_class_name
  gsub(/(^|_)([a-zA-Z])/) {$2.upcase}
end

#unescape_apostropheObject



13
14
15
# File 'lib/cuporter/extensions/string.rb', line 13

def unescape_apostrophe
  gsub(APOS_ENTITY, APOSTROPHE)
end