class String

Public Instance Methods

to_dash() click to toggle source
# File lib/wp_scaffold/helpers/text_helpers.rb, line 11
def to_dash
  self.gsub(/::/, '/').
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
  tr("_ ", "-").
  downcase
end
to_underscore() click to toggle source
# File lib/wp_scaffold/helpers/text_helpers.rb, line 3
def to_underscore
  self.gsub(/::/, '/').
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
  tr("- ", "_").
  downcase
end