Sha256: 76d64391d4229565651d3ff17388934de1e01257ffb34efd3faf3205fd16cd2f
Contents?: true
Size: 297 Bytes
Versions: 1
Compression:
Stored size: 297 Bytes
Contents
class String def snake_case self.gsub("::", "/") gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). gsub(/([a-z\d])([A-Z])/, '\1_\2'). tr("-", "_").downcase end def camelcase return self if self !~ /_/ && self =~ /[A-Z]+.*/ split("_").map { |str|str.capitalize }.join end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grimm-0.0.3 | lib/grimm/utilities.rb |