module CSVPP

Constants

DEFAULT_COL_SEP
VERSION

Public Class Methods

json(input:, format:, convert_type: true, col_sep: DEFAULT_COL_SEP) click to toggle source

@param input [String] input string @param format [String, Format] format string @param col_sep [String]

@return [String]

# File lib/csvpp.rb, line 62
def self.json(input:,
              format:,
              convert_type: true,
              col_sep: DEFAULT_COL_SEP)
  h = {
    'vars' => parse_str(
      input: input,
      format: format,
      convert_type: convert_type,
      col_sep: col_sep
    )
  }

  Oj.dump(h)
end
parse(input:, format:, col_sep: DEFAULT_COL_SEP, convert_type: true, &block) click to toggle source

@param input [String] path to input file @param format [String, Format] path to format file @param col_sep [String]

@return [Array<Object>]

# File lib/csvpp.rb, line 22
def self.parse(input:,
               format:,
               col_sep: DEFAULT_COL_SEP,
               convert_type: true,
               &block)

  Parser.parse(
    input: input,
    format: Format.load(format),
    col_sep: col_sep,
    convert_type: convert_type,
    &block
  )
end
parse_str(input:, format:, col_sep: DEFAULT_COL_SEP, convert_type: true, &block) click to toggle source

@param input [String] input string @param format [String, Format] format string @param col_sep [String]

@return [Array<Object>]

# File lib/csvpp.rb, line 42
def self.parse_str(input:,
                   format:,
                   col_sep: DEFAULT_COL_SEP,
                   convert_type: true,
                   &block)

  Parser.parse_str(
    input: input,
    format: Format.load_from_str(format),
    col_sep: col_sep,
    convert_type: convert_type,
    &block
  )
end