Sha256: 4850777a0c7bce77fb276cce0801d3dbf6c1855168212e9c5a84292799d48299
Contents?: true
Size: 444 Bytes
Versions: 7
Compression:
Stored size: 444 Bytes
Contents
class Nori module CoreExt module String # Returns the String in snake_case. def snakecase str = dup str.gsub! /::/, '/' str.gsub! /([A-Z]+)([A-Z][a-z])/, '\1_\2' str.gsub! /([a-z\d])([A-Z])/, '\1_\2' str.tr! ".", "_" str.tr! "-", "_" str.downcase! str end unless method_defined?(:snakecase) end end end String.send :include, Nori::CoreExt::String
Version data entries
7 entries across 7 versions & 2 rubygems