Sha256: 84fe584a31767abfb4e1c8efff8424746775e375d23b633a75336d0de4441cef
Contents?: true
Size: 447 Bytes
Versions: 53
Compression:
Stored size: 447 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
53 entries across 45 versions & 6 rubygems