inukshuk / anystyle

Fast citation reference parsing
https://anystyle.io
Other
1.06k stars 91 forks source link

Error: uninitialized constant AnyStyle::ParserCore::StringUtils in Ruby 3.2.2 #217

Closed gourshete closed 11 months ago

gourshete commented 11 months ago

After upgrading Ruby to 3.2.2 and Rails 6.1, we were facing issue with NoMethodError (undefined method 'untaint' for .rvm/gems/ruby-3.2.2/gems/anystyle-parser-0.8.2/resources/train.txt":String):.

previous version - 0.8.2 (no tag) Ruby - 2.5 Rails - 5.2

After looking at merged PRs, found that it was fixed in https://github.com/inukshuk/anystyle/pull/202. So upgraded to the latest version (latest commit) & untaint error is resolved. But now getting error with StringUtils -

uninitialized constant AnyStyle::ParserCore::StringUtils
from /.rvm/gems/ruby-3.2.2/gems/anystyle-1.4.2/lib/anystyle/parser.rb:3:in `<class:ParserCore>'

Tried solving it by adding

require_relative 'utils'

It solved for this, but again raised same error for include Format::BibTeX and so on. Any possible solution to this? Thanks in advance.

inukshuk commented 11 months ago

How are you requiring AnyStyle and BibTeX? It looks like the modules are not loaded in the right order.

gourshete commented 11 months ago

Not sure of order. In project only AnyStyle is required using require 'anystyle/parser'.

I think require of BibTex is from https://github.com/inukshuk/anystyle/blob/main/lib/anystyle.rb#L50. BibTex is not exclusively required in project.

gourshete commented 11 months ago

Closing this, seems not relevant here. Thanks for the patience.

inukshuk commented 11 months ago

You should change that to require 'anystyle' with the new Gem.