feat(code-graph): index Ruby lambda and Proc assignments as Lambda definitions
What does this MR do and why?
Indexes Ruby lambda and Proc assignments as named Lambda definitions instead of opaque Constants, so the graph can answer "what callable constants exist?" and "which files reference TRIPLE?".
Before, every constant assignment — MAX = 2 and TRIPLE = ->(x) { x * 3 } alike — was emitted as a generic Constant, and a lowercase handler = ->{} was not indexed at all. Now all four Ruby callable forms become Lambda definitions keyed on the LHS name:
| Form | Example |
|---|---|
| Stabby lambda | TRIPLE = ->(x) { x * 3 } |
lambda block |
DOUBLE = lambda { |x| x * 2 } |
proc block |
VALIDATE = proc { |e| e.include?('@') } |
Proc.new |
MAKER = Proc.new { |x| x } |
This mirrors the existing Python assignment → Lambda rule.
Related Issues
Closes #715 (closed)
Testing
- New
crates/integration-tests-codegraph/fixtures/ruby/lambda_defs.yamlsuite - New Ruby parser unit test in
ruby.rs. - Updated
top_level_constants.yamlfor thePROC_CONSTreclassification.
Performance Analysis
- This merge request does not introduce any performance regression. If a performance regression is expected, explain why.
Agent context — long-form analysis, file-by-file walkthroughs, profiler output, alternatives considered
- feat(code-graph): index Ruby lambda and Proc assignments as Lambda definitions
Ruby assignments whose RHS constructs a callable are now emitted as named Lambda definitions keyed on the LHS, instead of opaque Constants. This lets queries enumerate callable constants and resolve references to them.
Covers all four forms — stabby ->, lambda {}, proc {}, and Proc.new {} — and a lowercase-identifier LHS. A plain value constant and an ordinary .new constructor are left untouched. The new assignment -> Lambda scope rule is declared after the Constant rule so it wins for callable RHSes; a lambda constant is reclassified, not double-emitted. Mirrors Python's assignment -> Lambda rule.
Closes #715 (closed)
Closes #715 (closed)