Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to configure custom shortener #3

Open
zhisme opened this issue Nov 9, 2023 · 0 comments
Open

allow to configure custom shortener #3

zhisme opened this issue Nov 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@zhisme
Copy link
Owner

zhisme commented Nov 9, 2023

allow to configure custom shortener to not define every constant by hand

idea: is to put some constants list and feed it to shortener that will define himself those shorter version constants

# the default one
def shortener(klass_name)
  klass_name.to_s.gsub('::', '')
    .split(/[a-z]/).select { |lt| !lt.empty? }.join
end

shortener(MyClass)
# => MC
shortener(MyModule::MyClass)
# => MMMC
shortener(MyModule::MyModelsNamespace::Module)
# => MMNM
@zhisme zhisme added the enhancement New feature or request label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant