Conversation
- Add HasId, HasRemarks, HasRemarkItems marker modules in concerns.rb - Identifier auto-includes HasId - ModelElement#path uses is_a?(HasId) instead of method_defined?(:id) - ModelElement uses public_send instead of send - ExpFile includes HasId for correct path computation - InterfaceItem, InterfacedItem, RemarkItem include HasId - Schema children uses explicit interfaced_items method
- Formatter uses FORMATTER_REGISTRY for type-to-handler mapping - Each formatter module registers handlers via register_formatter - Removed private visibility from formatter module methods - HyperlinkFormatter and SchemaHeadFormatter use <= inheritance check - PrettyFormatter simplified with registry dispatch
…_attacher - COLLECTION_REGISTRY maps model types to collection attributes - EXPRESSION_CHILDREN maps expression/statement types for query traversal - collect_children and calculate_children_end_line use registry - find_query_in_expression uses targeted traversal - Builder qualifier returns IndexReference instead of Hash
- coverage.rb uses is_a?(HasRemarks), is_a?(HasRemarkItems), is_a?(HasId) - Repository#restore_indexes replaces instance_variable_set usage - Package::Reader uses public API instead of ivar manipulation
- formatter_architecture_spec.rb tests registry dispatch, marker modules - formatter_roundtrip_spec.rb adds AGGREGATE OF, CONSTANT, syntax.exp tests - unique_rule_spec.rb fixes be_empty to be_nil
38b4ab9 to
571a6c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces runtime type introspection (
method_defined?,respond_to?,send) with explicit marker modules and registry-based dispatch throughout the codebase.Changes
Marker modules (
Model::Concerns)HasId— included byIdentifier,ExpFile,InterfacedItem,InterfaceItem,RemarkItemHasRemarks,HasRemarkItems— included by relevant declaration typesRegistry-based formatter dispatch
FORMATTER_REGISTRYhash maps model classes to handler modulesregister_formattercase/whenchains inFormatterandPrettyFormatterCOLLECTION_REGISTRY in remark_attacher
respond_to?/sendprobing on every nodeEXPRESSION_CHILDRENregistry for targeted query expression traversalOther improvements
ModelElement#pathusesis_a?(HasId)instead ofmethod_defined?(:id)Repository#restore_indexesreplacesinstance_variable_setPackage::Readeruses public API instead of ivar manipulationIndexReferenceinstead ofHashTesting
formatter_architecture_spec.rbvalidates registry and marker module behavior