No mention of pattern matching being used with a case statement:
https://docs.ruby-lang.org/en/3.0/syntax/pattern_matching_rd...
This is where some real magic happens.
https://docs.ruby-lang.org/en/3.0/syntax/pattern_matching_rd...
This is where some real magic happens.
in [::Integer => data1, ::Integer => data2, ::Integer => data3, ::Array => data4] if (
data1.bit_length.<=(32) and data2.bit_length.<=(16) and data3.bit_length.<=(16) and (
data4.size.eql?(8) and data4.all?(&::Integer::method(:===)) and data4.max.bit_length.<=(8)
)
) thenI just learned this myself from another comment in this thread.
UPD: why do you write `obj.<=(16)` instead of `obj <= 16`? is this a performance thing or a matter of style or something else?
https://www.akshaykhot.com/ruby-switch-statement#pattern-mat...