Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
CSV::Row#push
row.push(*values) → self
lib/csv/row.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/csv/row.rb, line 410
def push(*args)
args.each { |arg| self << arg }
self # for chaining
end
Appends each of the given values to self as a field; returns self:
Example
source = "Name,Name,Name\nFoo,Bar,Baz\n" table = CSV.parse(source, headers: true) row = table[0] row.push('Bat', 'Bam') row # => #<CSV::Row "Name":"Foo" "Name":"Bar" "Name":"Baz" nil:"Bat" nil:"Bam">