
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
This ensures that the CSV
never returns nil
when parsing.
Additionally, empty strings will not be quoted when generating CSV.
Install the gem and add to the application's Gemfile by executing:
$ bundle add sane_csv
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install sane_csv
require 'sane_csv'
CSV
may return nil
, but using SaneCsv
ensures it never returns nil
.
The default behavior of CSV
:
require 'csv'
CSV.parse('a,,b')[0]
#=> ["a", nil, "b"]
To avoid returning nil
, you need to specify the nil_value
option:
require 'csv'
CSV.parse('a,,b', nil_value: "")[0]
#=> ["a", "", "b"]
When using SaneCsv
:
require 'sane_csv'
CSV.parse('a,,b')[0]
#=> ["a", "", "b"]
If you have a special situation where you want to return nil
, you can specify the nil_value
option:
require 'sane_csv'
CSV.parse('a,,b', nil_value: nil)[0]
#=> ["a", nil, "b"]
Additionally, when generating CSV
, empty strings are not unnecessarily quoted:
require 'sane_csv'
['a', '', 'b'].to_csv
#=> "a,,b\n"
If you have a specific reason to quote empty strings, you can specify quote_empty
:
require 'sane_csv'
['a', '', 'b'].to_csv(quote_empty: true)
#=> "a,\"\",b\n"
FAQs
Unknown package
We found that sane_csv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.