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.
MODIFY
mrbgems/mruby-symbol-ext/mrblib/symbol.rb
mrbgems/mruby-symbol-ext/mrblib/symbol.rb
@@ -3,12 +3,6 @@ class Symbol
alias intern to_sym
- def to_proc
- ->(obj,*args,&block) do
- obj.__send__(self, *args, &block)
- end
- end
-
##
# call-seq:
# sym.capitalize -> symbol

MODIFY
mrbgems/mruby-symbol-ext/test/symbol.rb
mrbgems/mruby-symbol-ext/test/symbol.rb
##
# Symbol(Ext) Test
-assert('Symbol#to_proc') do
- assert_equal 5, :abs.to_proc[-5]
-end
-
assert('Symbol.all_symbols') do
foo = [:__symbol_test_1, :__symbol_test_2, :__symbol_test_3].sort
symbols = Symbol.all_symbols.select{|sym|sym.to_s.include? '__symbol_test'}.sort

ADD
mrblib/symbol.rb
+class Symbol
+ def to_proc
+ ->(obj,*args,&block) do
+ obj.__send__(self, *args, &block)
+ end
+ end
+end

MODIFY
test/t/symbol.rb
test/t/symbol.rb
@@ -28,3 +28,7 @@ end
assert('Symbol#to_sym', '15.2.11.3.4') do
assert_equal :abc, :abc.to_sym
end
+
+assert('Symbol#to_proc') do
+ assert_equal 5, :abs.to_proc[-5]
+end

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.