
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
= CSVobj
== Aims
CSVobj has two simple aims in the processing of CSV files:
It achieves these aims by automatically instantiating a class with dynamic attributes that can be used to refer to each column of the CSV by name. Each attribute name is derived in a predictable fashion from the column headers (the first row of the CSV).
=== Clarity
Rather than referring programatically to the "third element of the row" ("row[2]") one can simply say "row.last_name".
=== Robustness
Any change to the CSV format (eg by inserting a new column between two existing columns) will not require a program change: you do not need to hunt down all references to "row[2]" and make them "row[3]"; they remain "row.last_name".
== Example
Given the following CSV file:
First Name,Last Name
Cheryl,James
Sandra,Denton
Deidra,Roper
we can extract just the last names as follows:
# Get the gem
require 'rubygems'
require 'csvobj'
# Subclass because #parse defines methods on the class
class MyCsv < CSVobj ; end
# First command line argument is CSV file to read
csv_file = File.new( ARGV[0] )
# Parse the file, print the "last name" column of each row
MyCsv.parse(csv_file).each do |row|
puts row.last_name
end
FAQs
Unknown package
We found that csvobj 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.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.