Can't open document using a Pathname. Breaking change between 0.4.0 and 0.6.0
Describe the bug
Upgrading gem from 0.4 to 0.6. Code no longer works since I call Document.open with a Pathname
To Reproduce
see example
example
require 'docx'
pn = Pathname.new("/home/me/mydoc.docx")
doc = Docx::Document.new(pn)
=> undefined method `close' for nil:NilClass
Sample docx file
N/A
Expected behavior
document object could be opened with a Pathname as in version 0.4
Environment
- Ruby version: (jruby 9.2.14.0 - ruby 2.5.7)
docxgem version: [0.6.0- OS: Ubuntu
HI, Docx::Document.new does not support Pathname, expects the path to a docx file given as String.
So the following code would work:
doc = Docx::Document.new("/home/me/mydoc.docx")
if you have any reason why you need to use Pathname instead of String, could you explain it?
Hi,
Since the major version number of the gem had not changed I thought the API-break was unintentional. Hence the report.
I noticed the issue with some old code using Pathname instead of String. But I can live without Pathname, no problem.