Page 165, paragraph before Case Pattern Matching, first line :
And second, you cannot do a variable assignment inside a pattern that uses the | to provide
That’s true, and the 3.1.2 documentation pattern_matching - RDoc Documentation also says (at the end of the section Variable binding) :
Variables that start with _ are the only exclusions from this rule:
case {a: 1, b: 2}
in {a: _, b: _foo} | Array
"matched: #{_}, #{_foo}"
else
"not matched"
end
# => "matched: 1, 2"