roo: Not compatible with Ruby 3
Steps to reproduce
test.csv
test,test
test2,test2
test.rb
require 'roo'
csv = Roo::CSV.new('test.csv')
puts csv.last_row
Issue
Works with Ruby 2.7.2.
Error with Ruby 3.0.0 Preview 1
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1391:in `initialize': no implicit conversion of Hash into String (TypeError)
from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1391:in `open'
from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1391:in `open'
from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1175:in `foreach'
from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/roo-2.8.3/lib/roo/csv.rb:96:in `each_row'
from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/roo-2.8.3/lib/roo/csv.rb:71:in `read_cells'
from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/roo-2.8.3/lib/roo/base.rb:119:in `block (2 levels) in <class:Base>'
from test.rb:3:in `<main>'
System configuration
Roo version:
gem 'roo', '~> 2.8', '>= 2.8.3'
Ruby version:
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19](works)ruby 3.0.0preview1 (2020-09-25 master 0096d2b895) [x86_64-darwin19](doesn’t work)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 15
- Comments: 17 (3 by maintainers)
Thanks for fixing this issue on the master branch! However could you please release a new bugfix version?
It seems master is compatible. Maybe release a new version?
Seconding the need for this fix now that Ruby 3.0 is released
This gem is a dependency of other gems like simple-spreadsheet so a proper release is in order.
@uzian Commit https://github.com/roo-rb/roo/commit/22d99302b34c5a38acfc2806daaf94a449f1e821 fixes compatibility with Ruby-3.0.
Wow. Let me check please. I’m sorry I’m little bit get our due to the situation in Ukraine from where i’m originally.
Thank you Erik, but how can I add this commit version of Roo (or the master one) to the global gem system with the unix
gemcommand line tool? (from Ruby-3.0.2) – MauriceIn case this helps someone, you are able to use the patched code by fetching a specific commit rather than a released gem:
@simonoff Thanks a lot… and мир Україні зараз!
@diam I’ve never done that, but I’d try either to build the gem yourself and install it or use the specific_install gem.