Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/whereby.rb

Instance Method Summary collapse

Instance Method Details

#whereby_camelizeObject



34
35
36
# File 'lib/whereby.rb', line 34

def whereby_camelize
  split('_').collect(&:capitalize).join
end

#whereby_lower_camelizeObject



38
39
40
41
# File 'lib/whereby.rb', line 38

def whereby_lower_camelize
  res = whereby_camelize
  res[0].downcase + res[1..-1]
end

#whereby_underscoreObject



26
27
28
29
30
31
32
# File 'lib/whereby.rb', line 26

def whereby_underscore
  gsub(/::/, '/')
    .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
    .gsub(/([a-z\d])([A-Z])/,'\1_\2')
    .tr('-', '_')
    .downcase
end