module Mycrm::CoreExt::String

Public Instance Methods

to_address() click to toggle source
# File lib/mycrm/core_ext/string.rb, line 19
def to_address
  Mycrm::CoreExt::Address.new(self)
end
to_camelized() click to toggle source
# File lib/mycrm/core_ext/string.rb, line 14
def to_camelized
  return self if self.to_s !~ /_/ && self.to_s =~ /[A-Z]+.*/
  self.to_s.split('_').collect(&:capitalize).join
end
to_underscore() click to toggle source
# File lib/mycrm/core_ext/string.rb, line 6
def to_underscore
  self.to_s.gsub(/::/, '/')
    .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
    .gsub(/([a-z\d])([A-Z])/,'\1_\2')
    .tr("-", "_")
    .downcase
end