ruby-numo / numo-narray

Ruby/Numo::NArray - New NArray class library
http://ruby-numo.github.io/narray/
BSD 3-Clause "New" or "Revised" License
413 stars 41 forks source link

Use rb_funcallv_kw function when calling method with keyword arguments #185

Closed yoshoku closed 3 years ago

yoshoku commented 3 years ago

This pull request fixes issue #184. In Ruby 2.7 and later, it is preferable to use rb_funcallv_kw when calling method with keyword arguments.

master branch:

irb(main):001:0> require 'numo/narray'
=> true
irb(main):002:0> a=Numo::Int32[1,2,3]
=>
Numo::Int32#shape=[3]
...
irb(main):003:0> b=Numo::DFloat[[4],[5],[6]]
=>
Numo::DFloat#shape=[3,1]
...
irb(main):004:0> a.dot(b)
/Users/yoshoku/.anyenv/envs/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/numo-narray-0.9.1.9/lib/numo/narray/extra.rb:1116: warning: Using the last argument as keyword parameters is deprecated
=>
Numo::DFloat#shape=[1]
[32]

This PR:

irb(main):001:0> require 'numo/narray'
=> true
irb(main):002:0> a=Numo::Int32[1,2,3]
=>
Numo::Int32#shape=[3]
...
irb(main):003:0> b=Numo::DFloat[[4],[5],[6]]
=>
Numo::DFloat#shape=[3,1]
...
irb(main):004:0> a.dot(b)
=>
Numo::DFloat#shape=[1]
[32]