8000 Adds and passes test for blank and nil csv values by nolantait · Pull Request #876 · yippee-fun/phlex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adds and passes test for blank and nil csv values #876

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

Merged
merged 3 commits into from
Mar 17, 2025

Conversation

nolantait
Copy link
Contributor
@nolantait nolantait commented Mar 7, 2025

Currently, calling a CSV template with blank or nil values fails when looking up the first byte:

# lib/phlex/csv.rb

if FORMULA_PREFIXES_MAP[value.getbyte(0)]

# ...

first_byte = value.getbyte(0)
if FORMULA_PREFIXES_MAP[first_byte]

Raises a confusing eval error: no implicit conversion from nil to integer

This PR adds and passes specs that match the options for stripping whitespace.

Its currently written to do either:

  • "" for blank values if not stripping whitespace, Ruby parses them to ""
  • Nothing when stripping whitespace, Ruby parses them it to nil

Closes #878

Signed-off-by: Joel Drapper <joel@drapper.me>
@joeldrapper joeldrapper merged commit 32699ae into yippee-fun:main Mar 17, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSV templates raise an error when a cell is blank
2 participants
0