Class: String

Inherits:
Object show all
Defined in:
lib/crackoid/core_extensions.rb

Overview

class FalseClass

Instance Method Summary collapse

Instance Method Details

#snake_caseObject



62
63
64
65
66
# File 'lib/crackoid/core_extensions.rb', line 62

def snake_case
  return self.downcase if self =~ /^[A-Z]+$/
  self.gsub(/([A-Z]+)(?=[A-Z][a-z]?)|\B[A-Z]/, '_\&') =~ /_*(.*)/
  return $+.downcase
end