class String

Public Instance Methods

camelize() click to toggle source
# File lib/sharepoint-stringutils.rb, line 18
def camelize
  self.split("_").each {|s| s.capitalize! }.join("")
end
pluralize() click to toggle source
# File lib/sharepoint-stringutils.rb, line 26
def pluralize
  if self.match /y$/
    self.gsub /y$/, 'ies'
  elsif self.match /us$/
    self.gsub /us$/, 'i'
  else
    self + 's'
  end
end
underscore() click to toggle source
# File lib/sharepoint-stringutils.rb, line 6
def underscore
  self.gsub(/::/, '/').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr("-", "_").
    downcase
end