Module: Hecks::Runtime::DependencyPlanning::ExpressionReads
- Defined in:
- lib/hecks/runtime/dependency_planning.rb
Class Method Summary collapse
- .collect(node, bound_names) ⇒ Object
-
.paths(canonical) ⇒ Object
Read the same parsed canonical-expression nodes the evaluator uses.
Class Method Details
.collect(node, bound_names) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/hecks/runtime/dependency_planning.rb', line 44 def collect(node, bound_names) case node when Bluebook::Expression::Resolver::Lookup root = node.path.to_s.split(".", 2).first bound_names.include?(root) ? [] : [node.path.to_s] when Bluebook::Expression::Resolver::BlockPredicate collect(node.receiver, bound_names) + collect(node.predicate, bound_names | [node.param.to_s]) when Struct node.each_pair.flat_map { |_name, value| collect(value, bound_names) } when Array node.flat_map { |value| collect(value, bound_names) } else [] end end |
.paths(canonical) ⇒ Object
Read the same parsed canonical-expression nodes the evaluator uses. A generic Struct walk keeps this additive when the expression grammar gains a composed node; only Lookup nodes carry domain dependencies.
40 41 42 |
# File 'lib/hecks/runtime/dependency_planning.rb', line 40 def paths(canonical) collect(Bluebook::Expression::Evaluator.parse(canonical), Set.new) end |