Actions
Bug #16660
closedStruct#deconstruct_keys inconsistent behavior
Bug #16660:
Struct#deconstruct_keys inconsistent behavior
Description
Here is an example of a kind of surprising (at least to me) Struct#deconstruct_keys behaviour:
- When some keys are not recognized and the total number of the keys is not greater than the size of the struct:
- When some keys are not recognized but the total number of the keys is greater than the size of the struct:
It's not clear why the first one filters unknown keys and the latter one returns an empty Hash instead of the {a: 1}.
This behaviour was introduced in https://github.com/ruby/ruby/commit/2439948bcc0ec9daf91cf79301195e59bad49aff. Prior to that change an empty hash was returned in both cases.
Actions