stop using shared dir

This commit is contained in:
Joey Cardosi 2025-05-30 14:33:22 -04:00
commit 5cc3d9d526
No known key found for this signature in database
GPG key ID: 5F93AEDDAAE66774

26
lib/mcp/string_utils.rb Normal file
View file

@ -0,0 +1,26 @@
# 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