public record RubyClass()

in doc-architect/doc-architect-core/src/main/java/com/docarchitect/core/scanner/ast/RubyAst.java [49:91]


    public record RubyClass(
        String name,
        String superclass,
        List<Method> methods,
        List<String> beforeActions,
        int lineNumber
    ) {
        public RubyClass {
            Objects.requireNonNull(name, "name must not be null");
            superclass = superclass != null ? superclass : "";
            methods = methods != null ? List.copyOf(methods) : List.of();
            beforeActions = beforeActions != null ? List.copyOf(beforeActions) : List.of();
        }

        /**
         * Check if this class inherits from a specific parent class.
         *
         * <p>Matches exact name, fully-qualified name (e.g., "Rails::Controller"),
         * or partial qualified name (e.g., "ApplicationController").
         *
         * @param parentClass parent class name to check
         * @return true if this class inherits from parentClass
         */
        public boolean inheritsFrom(String parentClass) {
            if (superclass == null || superclass.isEmpty()) {
                return false;
            }
            return superclass.equals(parentClass) ||
                   superclass.endsWith("::" + parentClass) ||
                   superclass.contains(parentClass);
        }

        /**
         * Check if this is a Rails controller class.
         *
         * @return true if class inherits from ApplicationController or ActionController
         */
        public boolean isController() {
            return inheritsFrom("ApplicationController") ||
                   inheritsFrom("ActionController::Base") ||
                   inheritsFrom("ActionController");
        }
    }