Sha256: 16dc8b111db8efaf6ac0bc272074f0d1244fc286f7c63828e83203f9504bd9d3
Contents?: true
Size: 451 Bytes
Versions: 8
Compression:
Stored size: 451 Bytes
Contents
module Wasabi module CoreExt module String # Returns the String in snakecase. 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, Wasabi::CoreExt::String
Version data entries
8 entries across 8 versions & 2 rubygems