class String
Public Instance Methods
sanitize_path!()
click to toggle source
# File lib/pup/utilities/string.rb, line 14 def sanitize_path! replace(self[0..-2]) if self[-1] == "/" replace("/" + self) if self[0] != "/" end
to_camelcase()
click to toggle source
# File lib/pup/utilities/string.rb, line 2 def to_camelcase split("_").map(&:capitalize).join end
to_snakecase()
click to toggle source
# File lib/pup/utilities/string.rb, line 6 def to_snakecase gsub(/::/, "/"). gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). gsub(/([a-z\d])([A-Z])/, '\1_\2'). tr("-", "_"). downcase end