2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2013-09-20 06:29:09 +00:00
|
|
|
class Class
|
2013-09-21 22:50:23 +00:00
|
|
|
def to_app_model_url
|
2018-12-22 14:43:03 +00:00
|
|
|
@to_app_model_url ||= begin
|
2021-05-12 11:37:44 +00:00
|
|
|
to_s.gsub(%r{::}, '_')
|
|
|
|
.gsub(%r{([A-Z]+)([A-Z][a-z])}, '\1_\2')
|
|
|
|
.gsub(%r{([a-z\d])([A-Z])}, '\1_\2')
|
2018-12-22 14:43:03 +00:00
|
|
|
.tr('-', '_')
|
|
|
|
.downcase
|
|
|
|
end
|
2013-09-20 06:29:09 +00:00
|
|
|
end
|
2015-05-07 10:27:12 +00:00
|
|
|
|
2013-09-21 22:50:23 +00:00
|
|
|
def to_app_model
|
2021-05-12 11:37:44 +00:00
|
|
|
@to_app_model ||= to_s.gsub(%r{::}, '').to_sym
|
2013-09-21 22:40:19 +00:00
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|