End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Object#CSV
CSV(*args, **options, &block)
lib/csv.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/csv.rb, line 2869
def CSV(*args, **options, &block)
CSV.instance(*args, **options, &block)
end
Passes args to CSV::instance.
Example
CSV("CSV,data").read #=> [["CSV", "data"]]
If a block is given, the instance is passed the block and the return value becomes the return value of the block.
Example
CSV("CSV,data") { |c| c.read.any? { |a| a.include?("data") } } #=> true CSV("CSV,data") { |c| c.read.any? { |a| a.include?("zombies") } } #=> false
CSV options may also be given.
Example
io = StringIO.new CSV(io, col_sep: ";") { |csv| csv << ["a", "b", "c"] }
This API is not Ractor-safe.