Commit 9dab3c5
authored
[DOC] Mention
```ruby
h = {foo: 0, bar: 1, baz: 2}
proc = h.to_proc
proc.call(:nosuch) # => nil
h.default_proc = proc {'wow!'} # This affects `proc` immediately
proc.call(:nosuch) # => 'wow!'
```
This behavior is a bit of surprise to me, and I could not find
any mention to this behavior in current doc.Hash#default_proc= affects Proc object from Hash#to_proc
1 parent e0a7dad commit 9dab3c5
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5012 | 5012 | | |
5013 | 5013 | | |
5014 | 5014 | | |
| 5015 | + | |
| 5016 | + | |
5015 | 5017 | | |
5016 | 5018 | | |
5017 | 5019 | | |
| |||
0 commit comments