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

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nolantait
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant