Skip to content

Commit

Permalink
[Truffle] The evaluated block takes precedence over the default value…
Browse files Browse the repository at this point in the history
… in Hash#fetch.
  • Loading branch information
nirvdrum committed Dec 21, 2014
1 parent 9a02641 commit 58f2f14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/ruby/jruby/truffle/core/shims.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58f2f14

Please sign in to comment.