Class: String

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

Instance Method Summary collapse

Instance Method Details

#relinkly_camelizeObject



41
42
43
# File 'lib/relinkly.rb', line 41

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

#relinkly_lower_camelizeObject



45
46
47
48
# File 'lib/relinkly.rb', line 45

def relinkly_lower_camelize
  res = relinkly_camelize
  res[0].downcase + res[1..-1]
end

#relinkly_underscoreObject



33
34
35
36
37
38
39
# File 'lib/relinkly.rb', line 33

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