prawnpdf / prawn-table

Provides support for tables in Prawn
Other
205 stars 98 forks source link

Add Time to the class of values that can be used in a cell. Avoid error when value is passed in options #135

Closed petergoldstein closed 2 years ago

petergoldstein commented 2 years ago

This is a combination of #103 and #119 with tests for both cases. Thanks to @schlick and @tetsuya-ogawa for the original PRs.

@pointlessone Since the original PRs overlap, and tests were only included in one of them, I think this is a good combination PR. Missing tests were added.

It also makes it easy to add future types to be stringified and, should it be desired, to change the behavior to stringify anything but Prawn::Table, Prawn::Table::Cell, or Array that responds to a to_s

@gettalong any comments are welcome as well.

petergoldstein commented 2 years ago

@gettalong Yeah, I was aware of the slight behavior change but I don't think it's an issue because:

  1. We were already executing that change in the case where options[:content] was nil - options[:content] was being set to the empty string.
  2. There doesn't appear to be a downstream case where the content being a Date/Time/Numeric was functional. All of those look like they should get routed to the Text cell case.
petergoldstein commented 2 years ago

@pointlessone This does override #103. If we merge this PR (which is my preference), we can close #103 . Given that @schlick - the original author of #103 - gave this a thumbs up, I assume that he's good with that approach as well.