Skip to content
Permalink
Browse files
[Truffle] The evaluated block takes precedence over the default value…
… in Hash#fetch.
  • Loading branch information
nirvdrum committed Dec 21, 2014
1 parent 9a02641 commit 58f2f14ff369d95fadc88cfd9e6989d90e3379b0
Showing with 2 additions and 2 deletions.
  1. +2 −2 core/src/main/ruby/jruby/truffle/core/shims.rb
@@ -30,10 +30,10 @@ class Hash
def fetch(key, default=nil)
if key?(key)
self[key]
elsif default
default
elsif block_given?
yield(key)
elsif default
default
else
raise(KeyError, "key not found: #{key}")
end

0 comments on commit 58f2f14

Please sign in to comment.