now using String refinement

Events Director module renamed

patch bump
This commit is contained in:
2023-08-29 22:55:11 +01:00
parent 3a0f298045
commit 4c4746fe8a
4 changed files with 19 additions and 17 deletions

View File

@@ -1,15 +1,16 @@
module OBSWS
module Util
module String
def camelcase(s)
s.split("_").map(&:capitalize).join
end
module CoreExtensions
refine String do
def camelcase
split("_").map(&:capitalize).join
end
def snakecase(s)
s
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
.downcase
def snakecase
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
.downcase
end
end
end
end