summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-hash-ext
diff options
context:
space:
mode:
authorAsmod4n <[email protected]>2015-09-17 13:24:17 +0200
committerAsmod4n <[email protected]>2015-09-17 13:24:17 +0200
commite6d9b450bab46f218e6bee2c95114b733660951a (patch)
treee6e296d99ad3780e769a5bae0d71bb5a6de75c9a /mrbgems/mruby-hash-ext
parent13a2cc3e5d27c33db7f4cf06ece4c44a79c79c53 (diff)
parent070e04ea22d832c323e56ff75242f08ca3022fa8 (diff)
downloadmruby-e6d9b450bab46f218e6bee2c95114b733660951a.tar.gz
mruby-e6d9b450bab46f218e6bee2c95114b733660951a.zip
Merge remote-tracking branch 'mruby/master'
Diffstat (limited to 'mrbgems/mruby-hash-ext')
-rw-r--r--mrbgems/mruby-hash-ext/mrbgem.rake2
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb4
-rw-r--r--mrbgems/mruby-hash-ext/test/hash.rb1
3 files changed, 4 insertions, 3 deletions
diff --git a/mrbgems/mruby-hash-ext/mrbgem.rake b/mrbgems/mruby-hash-ext/mrbgem.rake
index 663de2166..f01033a6c 100644
--- a/mrbgems/mruby-hash-ext/mrbgem.rake
+++ b/mrbgems/mruby-hash-ext/mrbgem.rake
@@ -1,7 +1,7 @@
MRuby::Gem::Specification.new('mruby-hash-ext') do |spec|
spec.license = 'MIT'
spec.author = 'mruby developers'
- spec.summary = 'extensional Hash class'
+ spec.summary = 'Hash class extension'
spec.add_dependency 'mruby-enum-ext', :core => 'mruby-enum-ext'
spec.add_dependency 'mruby-array-ext', :core => 'mruby-array-ext'
end
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb
index ea5e6bc1b..5056d0720 100644
--- a/mrbgems/mruby-hash-ext/mrblib/hash.rb
+++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb
@@ -119,14 +119,14 @@ class Hash
#
# <em>produces:</em>
#
- # prog.rb:2:in `fetch': key not found (KeyError)
+ # prog.rb:2:in 'fetch': key not found (KeyError)
# from prog.rb:2
#
def fetch(key, none=NONE, &block)
unless self.key?(key)
if block
- block.call
+ block.call(key)
elsif none != NONE
none
else
diff --git a/mrbgems/mruby-hash-ext/test/hash.rb b/mrbgems/mruby-hash-ext/test/hash.rb
index e1afdaaa3..4950ef354 100644
--- a/mrbgems/mruby-hash-ext/test/hash.rb
+++ b/mrbgems/mruby-hash-ext/test/hash.rb
@@ -75,6 +75,7 @@ assert('Hash#fetch') do
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