-
Notifications
You must be signed in to change notification settings - Fork 503
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
Getting deprecated Cell.new, use Cell.create_cell for set() method of excelx.rb file #529
Comments
cgunther
added a commit
to cgunther/roo
that referenced
this issue
Sep 22, 2021
Calling `Excelx#set` internally called `Excelx::Cell.new`, which is deprecated in favor of `Excelx::Cell.create_cell`. I tried using the recommended `Excelx::Cell.create_cell`, however it expects a `type` as the first argument. `#set` tries to infer the type via [`cell_type_by_value`](https://github.com/roo-rb/roo/blob/709464c77623be2bc09b2103405d90ded7604a75/lib/roo/base.rb#L175-L182), however it only returns `:float` or `:string`, but `Excelx::Cell.cell_class` doesn't support `:float`. Even if I add `:float` to map to `Cell::Number`, then there's a dilemma because `Excelx::Cell.create_cell` passes all the arguments except the first onto the specific cell class, but the arity of `Cell::String` is 5 whereas the arity of `Cell::Number` is 6, meaning `Excelx#set` would need to initialize each cell class individually to pass the appropriate arguments. Therefore I landed on simply using `Cell::Base`. It's probably not the most accurate, but given persisting the spreadsheet isn't an option, the uses for `Excelx#set` should be minimal. In my case, I simply use it in testing to avoid creating new files for every possible scenario, opting to manually set various cells to triggered assorted scenarios. Fixes roo-rb#529.
cgunther
added a commit
to cgunther/roo
that referenced
this issue
Mar 25, 2022
Calling `Excelx#set` internally called `Excelx::Cell.new`, which is deprecated in favor of `Excelx::Cell.create_cell`. I tried using the recommended `Excelx::Cell.create_cell`, however it expects a `type` as the first argument. `#set` tries to infer the type via [`cell_type_by_value`](https://github.com/roo-rb/roo/blob/709464c77623be2bc09b2103405d90ded7604a75/lib/roo/base.rb#L175-L182), however it only returns `:float` or `:string`, but `Excelx::Cell.cell_class` doesn't support `:float`. Even if I add `:float` to map to `Cell::Number`, then there's a dilemma because `Excelx::Cell.create_cell` passes all the arguments except the first onto the specific cell class, but the arity of `Cell::String` is 5 whereas the arity of `Cell::Number` is 6, meaning `Excelx#set` would need to initialize each cell class individually to pass the appropriate arguments. Therefore I landed on simply using `Cell::Base`. It's probably not the most accurate, but given persisting the spreadsheet isn't an option, the uses for `Excelx#set` should be minimal. In my case, I simply use it in testing to avoid creating new files for every possible scenario, opting to manually set various cells to triggered assorted scenarios. Fixes roo-rb#529.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When set method of excel sheet is used; it is showing error message 'deprecated Cell.new, use Cell.create_cell'.
The text was updated successfully, but these errors were encountered: