From ce916b99b81fedf6561f8d3303320b31aa27d51c Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 18 Oct 2017 10:18:43 +0900 Subject: Add `Hash#to_proc`; CRuby2.3 --- mrbgems/mruby-hash-ext/mrblib/hash.rb | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3