just redo all of it from scratch
This commit is contained in:
parent
0b49c3f711
commit
d80b13736e
1 changed files with 33 additions and 26 deletions
|
|
@ -1,26 +0,0 @@
|
|||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
module MCP
|
||||
module StringUtils
|
||||
extend self
|
||||
|
||||
def handle_from_class_name(class_name)
|
||||
underscore(demodulize(class_name))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def demodulize(path)
|
||||
path.to_s.split("::").last || path.to_s
|
||||
end
|
||||
|
||||
def underscore(camel_cased_word)
|
||||
camel_cased_word.dup
|
||||
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
||||
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
||||
.tr("-", "_")
|
||||
.downcase
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue