summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-09-20 12:06:53 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-09-20 13:47:29 +0900
commit3a9caad8ebe63dfe2b8583c72fc5e275f13e25c3 (patch)
treea5513bc961165f86c3f7a29ad4fc7b76474ee5b4 /mrblib
parent19d3bb2d90f9806ea6cdef97a139de9f2050363a (diff)
downloadmruby-3a9caad8ebe63dfe2b8583c72fc5e275f13e25c3.tar.gz
mruby-3a9caad8ebe63dfe2b8583c72fc5e275f13e25c3.zip
Move `Symbol#to_proc` to the core from `mruby-symbol-ext` gem.
Even though `Symbol#to_proc` is not included in ISO standard, the `some_method(&:method_name)` is used very widely and convenient. So we moved it to the core.
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/symbol.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/mrblib/symbol.rb b/mrblib/symbol.rb
new file mode 100644
index 000000000..9c981dd9e
--- /dev/null
+++ b/mrblib/symbol.rb
@@ -0,0 +1,7 @@
+class Symbol
+ def to_proc
+ ->(obj,*args,&block) do
+ obj.__send__(self, *args, &block)
+ end
+ end
+end