module QuestionsCrafter class Utils class << self # Returns a dasherized string that can be used as a prefix for HTML class names. It removes the Questions suffix. # Example: "SignUpQuestions" -> "sign-up" def html_class_name_prefix(questions:) name = questions.class.name name = name.demodulize.gsub(/Questions$/, "").underscore.dasherize name end end end end