Skip to content

Commit

Permalink
fix block variable in Hash#fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Sep 15, 2015
1 parent e91b7d6 commit b88ca62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mrbgems/mruby-hash-ext/mrblib/hash.rb
Expand Up @@ -126,7 +126,7 @@ def merge!(other, &block)
def fetch(key, none=NONE, &block)
unless self.key?(key)
if block
block.call
block.call(key)
elsif none != NONE
none
else
Expand Down
1 change: 1 addition & 0 deletions mrbgems/mruby-hash-ext/test/hash.rb
Expand Up @@ -75,6 +75,7 @@
assert_equal "feline", h.fetch("cat")
assert_equal "mickey", h.fetch("mouse", "mickey")
assert_equal "minny", h.fetch("mouse"){"minny"}
assert_equal "mouse", h.fetch("mouse"){|k| k}
begin
h.fetch("gnu")
rescue => e
Expand Down

0 comments on commit b88ca62

Please sign in to comment.