Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use worksheet without block #45

Merged
merged 8 commits into from
Jun 27, 2020

Conversation

sandstrom
Copy link
Contributor

Successor to #42

Credit to @kukicola

@felixbuenemann
Copy link
Owner

Could you describe how the commit "Track worksheet with WorksheetEntry" contributes to the close checking?

The commit message says it is needed, but I can't really see a relation the the close checking code.

Also why did you change the author on the initial commit by @kukicola?

@sandstrom
Copy link
Contributor Author

Thanks @felixbuenemann

It's needed because we need a reference to the worksheet, to check the closed? method, since only the worksheet knows whether it has been closed or not.

I never changed it, I just copied the diff. Couldn't work out how to fork his fork so I ended up recreating the commit instead. I wrote "credit @kukicola" in the commit message though. If it's important I can google and see if I can change the author via git CLI.

@sandstrom
Copy link
Contributor Author

@felixbuenemann I've managed to change the author of the commit (I think)

I've also made the change backwards-compatible.

Let me know what you think!

@kukicola
Copy link
Contributor

@felixbuenemann @sandstrom Hi guys! I like the idea of having those errors, good job! One thing that bothers me here: You are using WorksheetEntry to store a name and reference to a worksheet. Before it was a hash with id as a key and name as a value. Maybe instead of adding WorksheetEntry you can just use hash with id as a key and reference as a value, and store the name of the worksheet inside Worksheet class? I think it would be simpler. What do you think?

@sandstrom
Copy link
Contributor Author

sandstrom commented Jun 22, 2020

@kukicola Thanks! And thanks for bringing this up in the first place!

I actually wrote it that way first, but that would require more changes to the code since worksheets are created "on their own" in the tests. So to keep the change delta down I did this instead.

Don't have a strong preference though, if felix would like it that way instead I'm happy to change.

@felixbuenemann
Copy link
Owner

I think the most straighjt forward solution would be to just add the id and name properties to the Worksheet class and then just use an array of worksheet instances.

Since we store a referece to the worksheet class anyways, I don't see a reason to wrap it in a struct.

Am I missing something?

@sandstrom
Copy link
Contributor Author

@felixbuenemann Alright, I'll go with that.

We'd need to pass in "dummy" id and name in worksheet_test.rb, but it's fairly straightforward.

This method was never documented (private) so
it's unlikely that anyone was relying on it. But in case
they did we continue supporting this use-case and
emit a warning.
@sandstrom
Copy link
Contributor Author

@felixbuenemann @kukicola I've updated the PR, let me know what you think!

@felixbuenemann
Copy link
Owner

We'd need to pass in "dummy" id and name in worksheet_test.rb, but it's fairly straightforward.

I don't think we really need that, if we use default values.

I also don't quite like that we have the default value for name handled outside the worksheet class, when we could just pass it through via the options hash.

But I can take care of those when merging the code.

@sandstrom
Copy link
Contributor Author

@felixbuenemann Thanks Felix!

Do/change whatever you like here. You have commit rights to this branch (in my fork) if that helps.

Thanks for a great library! 🏅

and add the code location to the deprecation warning to help track down
the location of the deprecated call.
and hide the warning during test runs.

This allows to hide the warning using eg. RUBYOPT=-W0.
since it is already included by the workbook source.
@felixbuenemann felixbuenemann merged commit 461c515 into felixbuenemann:master Jun 27, 2020
@felixbuenemann
Copy link
Owner

@sandstrom @kukicola Thanks for your work on this, I've merged it with a few tweaks and fixes.

@felixbuenemann
Copy link
Owner

This feature is now released in xlsxtream 2.4.0.

@sandstrom
Copy link
Contributor Author

Awesome, thanks @felixbuenemann 🎉

@sandstrom sandstrom deleted the without-block branch June 29, 2020 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants