class Object - csv: Ruby Standard Library Documentation

# class Object

### Public Instance Methods

CSV(*args, **options, &block) click to toggle source

Passes `args` to `CSV::instance`.

    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.

    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.

    io = StringIO.new
    CSV(io, col_sep: ";") { |csv| csv << ["a", "b", "c"] }

This API is not Ractor-safe.

    # File csv-3.3.2/lib/csv.rb, line 3011
    def CSV(*args, **options, &block)
      CSV.instance(*args, **options, &block)
    end