File tree Expand file tree Collapse file tree 3 files changed +18
-10
lines changed
src/main/ruby/truffleruby/core Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -68,6 +68,24 @@ def captures
68
68
end
69
69
alias_method :deconstruct , :captures
70
70
71
+ def deconstruct_keys ( array_of_names )
72
+ Truffle ::Type . rb_check_type ( array_of_names , Array ) unless Primitive . nil? ( array_of_names )
73
+
74
+ hash = named_captures . transform_keys ( &:to_sym )
75
+ return hash if Primitive . nil? ( array_of_names )
76
+
77
+ ret = { }
78
+ return ret if array_of_names . size > hash . size
79
+
80
+ array_of_names . each do |key |
81
+ Truffle ::Type . rb_check_type ( key , Symbol )
82
+ break unless hash . key? ( key )
83
+ ret [ key ] = hash [ key ]
84
+ end
85
+
86
+ ret
87
+ end
88
+
71
89
def names
72
90
regexp . names
73
91
end
Original file line number Diff line number Diff line change 40
40
exclude :test_initialize_option , "<//m> expected but was"
41
41
exclude :test_initialize_bool_warning , "expected: /expected true or false as ignorecase/"
42
42
exclude :test_linear_time_p , "NoMethodError: undefined method `linear_time?' for Regexp:Class"
43
- exclude :test_match_data_deconstruct_keys , "NoMethodError: undefined method `deconstruct_keys' for #<MatchData \" foobarbaz\" >"
44
43
exclude :test_extended_comment_invalid_escape_bug_18294 , "assert_separately failed with error message"
45
44
exclude :test_timeout_nil , "NoMethodError: undefined method `timeout=' for Regexp:Class"
46
45
exclude :test_timeout_shorter_than_global , "NoMethodError: undefined method `timeout=' for Regexp:Class"
You can’t perform that action at this time.
0 commit comments