We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
> h = { 'a' => 1, 'b' => 2 }.freeze => {"a"=>1, "b"=>2} > h.delete('a') => 1 > h => {"b"=>2} > h.clear => {}
These operations should fail with can't modify frozen hash (RuntimeError).
can't modify frozen hash (RuntimeError)
This issue was reported by https://hackerone.com/an0n-j
The text was updated successfully, but these errors were encountered:
The submitter suggested adding mrb_hash_modify calls to mrb_hash_delete and mrb_hash_clear.
mrb_hash_modify
mrb_hash_delete
mrb_hash_clear
Sorry, something went wrong.
Add mrb_hash_modify() to Hash#{delete,clear}; ref #3370
2e0c2b5
I guess it need new method Kernel#frozen? to solve this issue.
Kernel#frozen?
E.g. Hash#delete_if
Hash#delete_if
def delete_if(&block) return to_enum :delete_if unless block_given? + raise RuntimeError, "can't modify frozen #{self.class}" if frozen? self.each do |k, v| self.delete(k) if block.call(k, v) end self end
Add new method Kernel#frozen?; ref #3370
36f5b44
No branches or pull requests
These operations should fail with
can't modify frozen hash (RuntimeError)
.This issue was reported by https://hackerone.com/an0n-j
The text was updated successfully, but these errors were encountered: