Sha256: 31ef54dc2d5c2a658583c7bf679c80ef3f8940822c4dd0c45595c2fc921a54ac
Contents?: true
Size: 321 Bytes
Versions: 39
Compression:
Stored size: 321 Bytes
Contents
class String # "FooBar".snake_case #=> "foo_bar" def snake_case gsub(/\B[A-Z]/, '_\&').downcase end # "foo_bar".camel_case #=> "FooBar" def camel_case str = gsub(/^[a-z]|_+[a-z]/) { |a| a.upcase } str.gsub(/_/, '') end def dash_case self.snake_case.gsub('_', '-') end end
Version data entries
39 entries across 39 versions & 1 rubygems