summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-hash-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-10-18 10:18:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-10-18 10:18:43 +0900
commitce916b99b81fedf6561f8d3303320b31aa27d51c (patch)
treee6b1a7f56e951470ca74acaf84664ced0f5dd713 /mrbgems/mruby-hash-ext
parentb5dfbce76702e8ef6891d8a995de405a14b4ee03 (diff)
downloadmruby-ce916b99b81fedf6561f8d3303320b31aa27d51c.tar.gz
mruby-ce916b99b81fedf6561f8d3303320b31aa27d51c.zip
Add `Hash#to_proc`; CRuby2.3
Diffstat (limited to 'mrbgems/mruby-hash-ext')
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb
index 7bf06a0ad..d1a709325 100644
--- a/mrbgems/mruby-hash-ext/mrblib/hash.rb
+++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb
@@ -475,6 +475,10 @@ class Hash
self
end
+ def to_proc
+ ->x{self[x]}
+ end
+
##
# call-seq:
# hsh.fetch_values(key, ...) -> array