hparra / ruby-serialport

ruby-serialport is a Ruby library that provides a class for using RS-232 serial ports
http://rubygems.org/gems/serialport
GNU General Public License v2.0
246 stars 58 forks source link

Remove rb_secure calls because it is deprecated and being removed in Ruby 3.0 #70

Closed DavidEGrayson closed 3 years ago

DavidEGrayson commented 3 years ago

This gem calls rb_secure, which means that when I run it in Ruby 2.7.4, I get these warnings:

/home/david/.gem/ruby/2.7.4/gems/serialport-1.3.1/lib/serialport.rb:25: warning: rb_safe_level_2_warning will be removed in Ruby 3.0
/home/david/.gem/ruby/2.7.4/gems/serialport-1.3.1/lib/serialport.rb:25: warning: rb_secure will be removed in Ruby 3.0

This pull request fixes the warning by simply removing the calls to rb_secure. I haven't tested the gem in Ruby 3, but this change should also help fix issue #69.

If anyone is using this gem in an application where they were using the Ruby Safe Levels feature, which is going away in Ruby 3, this change could make their code less safe.