Class: Hecks::Bluebook::Expression::Resolver::BlockPredicate

Inherits:
Struct
  • Object
show all
Defined in:
lib/hecks/bluebook/expression/resolver/block_predicates.rb

Overview

receiver.all? { |x| PREDICATE } / .any? { ... } / .none? { ... } -- vendored addition, not (yet) upstream hecks (migration plan task 9), completing the same Phrase four-segment invariant the Split node above was built for (value.split("::").all? { |s| s.length > 0 }). Structurally different from every other addition in this file: every prior suffix is a flat receiver -> scalar transform, but a block predicate needs to evaluate its own sub-expression ONCE PER ELEMENT with the block parameter bound to that element. Kept minimal per the migration plan's own instruction -- no persistent iteration-variable concept added to Resolver's state model at all ; predicate below is a fully-parsed EVALUATOR ast (not a Resolver ast -- the predicate is a boolean/comparison expression like s.length > 0, exactly the grammar Bluebook::Expression::Evaluator owns, not this module's own leaf grammar), parsed once at parse-time same as every sibling node's sub-expressions are. mode distinguishes all?/any?/none? without three duplicated node types, since their only difference is which Array predicate aggregates the per-element results (interpret_with_element, below, is the "smallest correct thing" the plan asked for -- it threads the element binding through a temporarily-extended attrs hash for that one predicate's evaluation only, never touching interpret's own signature or any other node's call sites). Resolver already calls into Evaluator elsewhere in this file (sign_test_node/apply_sign_test call Evaluator. apply/Evaluator::OPERATORS directly) -- this is the same precedented cross-reference, not a new coupling.

Instance Attribute Summary collapse

Instance Attribute Details

#modeObject

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



44
45
46
# File 'lib/hecks/bluebook/expression/resolver/block_predicates.rb', line 44

def mode
  @mode
end

#paramObject

Returns the value of attribute param

Returns:

  • (Object)

    the current value of param



44
45
46
# File 'lib/hecks/bluebook/expression/resolver/block_predicates.rb', line 44

def param
  @param
end

#predicateObject

Returns the value of attribute predicate

Returns:

  • (Object)

    the current value of predicate



44
45
46
# File 'lib/hecks/bluebook/expression/resolver/block_predicates.rb', line 44

def predicate
  @predicate
end

#receiverObject

Returns the value of attribute receiver

Returns:

  • (Object)

    the current value of receiver



44
45
46
# File 'lib/hecks/bluebook/expression/resolver/block_predicates.rb', line 44

def receiver
  @receiver
end