2013-09-20 06:29:09 +00:00
|
|
|
class Class
|
|
|
|
def to_app_model
|
2013-09-20 11:40:25 +00:00
|
|
|
camel_cased_word = self.to_s
|
|
|
|
camel_cased_word.gsub(/::/, '_').
|
|
|
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
|
|
|
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
|
|
|
tr("-", "_").
|
|
|
|
downcase
|
2013-09-20 06:29:09 +00:00
|
|
|
end
|
|
|
|
end
|