jonmagic / grim

Tool for extracting pages from pdf as images and text as strings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File.exists? deprecated since Ruby 2.1.0

fgiannattasio opened this issue · comments

commented

Hi,

As File.exists? has been deprecated since Ruby 2.1.0, would be nice to swith to File.exist? in lib/grim/pdf.rb

  1) Grim::Pdf should not raise NoMethodErrod for File:class
     Failure/Error:
       expect{
         pdf = Grim::Pdf.new(fixture_path("smoker.pdf"))
       }.not_to raise_error(NoMethodError)

       expected no NoMethodError, got #<NoMethodError: undefined method `exists?' for File:Class> with backtrace:
         # ./lib/grim/pdf.rb:18:in `initialize'
         # ./spec/lib/grim/pdf_spec.rb:8:in `new'
         # ./spec/lib/grim/pdf_spec.rb:8:in `block (3 levels) in <top (required)>'
         # ./spec/lib/grim/pdf_spec.rb:7:in `block (2 levels) in <top (required)>'
         # ./spec/lib/grim/pdf_spec.rb:7:in `block (2 levels) in <top (required)>'

Finished in 0.01266 seconds (files took 0.11393 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/lib/grim/pdf_spec.rb:6 # Grim::Pdf should not raise NoMethodErrod for File:class

It can be worked with adding class File; class << self; alias exists? exist?; end; end; but a fix would be much better.

Just ran into this today, I can throw a quick PR together if PRs are still actively being merged?

Still accepting contributions 👍 I'm currently on vacation though so it will be end of next week before I can test the changes and do a release (added to my calendar so I don't forget).

In the meantime feel free to use this method to install the version from #43 and see if it works for you.

Here are the bundler instructions for installing gems from a git repo: https://bundler.io/guides/git.html

commented

I am already 👍
Big thank you for spending time crafting this easy-to-use yet functional gem 💎 !!

Enjoy your vacation.

@fgiannattasio thank you so much for your contribution! I added you as a contributor to the README and pushed the new version to rubygems.org ❤️ https://rubygems.org/gems/grim