Skip to content
Snippets Groups Projects
Verified Commit f8617164 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Support adding spaces when camel casing

parent f4463d5f
No related branches found
No related tags found
No related merge requests found
Pipeline #103921 passed
...@@ -10,10 +10,10 @@ class String ...@@ -10,10 +10,10 @@ class String
.downcase .downcase
end end
def _cmdb_camel_case(capitalized: false) def _cmdb_camel_case(capitalized: false, spaced: false)
first, *rest = split("_") first, *rest = split("_")
first = first.capitalize if capitalized first = first.capitalize if capitalized
[first, rest.map(&:capitalize)].join [first, rest.map(&:capitalize)].join(spaced ? " " : nil)
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment