Class: CsvReader::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/csvreader/base.rb,
lib/csvreader/parser.rb

Constant Summary collapse

DEFAULT =

use/allow different “backends” e.g. ParserStd, ParserStrict, ParserTab, etc.

parser must support parse method (with and without block)
 e.g.  records = parse( data )
          -or-
       parse( data ) do |record|
       end
ParserStd.new
NUMERIC =
ParserStd.new( numeric: true,
nan: ['#NAN', 'NAN', 'NaN', 'nan' ],
null: "" )
RFC4180 =
ParserStrict.new
STRICT =

note: make strict its own instance (so you can change config without “breaking” rfc4180)

ParserStrict.new
EXCEL =

note: make excel its own instance (so you can change configs without “breaking” rfc4180/strict)

ParserStrict.new
MYSQL =
ParserStrict.new( sep: "\t",
quote: false,
escape: true,
null: "\\N" )
POSTGRES =
POSTGRESQL = ParserStrict.new( doublequote: false,
escape: true,
null: "" )
POSTGRES_TEXT =
POSTGRESQL_TEXT = ParserStrict.new( sep: "\t",
quote: false,
escape: true,
null: "\\N" )
TAB =
ParserTab.new
FIXED =
ParserFixed.new

Class Method Summary collapse

Class Method Details

.defaultObject

alternative alias for DEFAULT



70
# File 'lib/csvreader/base.rb', line 70

def self.default()         DEFAULT;         end

.excelObject

alternative alias for EXCEL



76
# File 'lib/csvreader/base.rb', line 76

def self.excel()           EXCEL;           end

.fObject



85
# File 'lib/csvreader/base.rb', line 85

def self.f()               fixed;           end

.fixObject



84
# File 'lib/csvreader/base.rb', line 84

def self.fix()             fixed;           end

.fixedObject



83
# File 'lib/csvreader/base.rb', line 83

def self.fixed()           FIXED;           end

.mysqlObject



77
# File 'lib/csvreader/base.rb', line 77

def self.mysql()           MYSQL;           end

.nObject



73
# File 'lib/csvreader/base.rb', line 73

def self.n()               numeric;         end

.numObject



72
# File 'lib/csvreader/base.rb', line 72

def self.num()             numeric;         end

.numericObject



71
# File 'lib/csvreader/base.rb', line 71

def self.numeric()         NUMERIC;         end

.postgresObject



79
# File 'lib/csvreader/base.rb', line 79

def self.postgres()        postgresql;      end

.postgres_textObject



81
# File 'lib/csvreader/base.rb', line 81

def self.postgres_text()   postgresql_text; end

.postgresqlObject



78
# File 'lib/csvreader/base.rb', line 78

def self.postgresql()      POSTGRESQL;      end

.postgresql_textObject



80
# File 'lib/csvreader/base.rb', line 80

def self.postgresql_text() POSTGRESQL_TEXT; end

.rfc4180Object

alternative alias for RFC4180



75
# File 'lib/csvreader/base.rb', line 75

def self.rfc4180()         RFC4180;         end

.strictObject

alternative alias for STRICT



74
# File 'lib/csvreader/base.rb', line 74

def self.strict()          STRICT;          end

.tabObject



82
# File 'lib/csvreader/base.rb', line 82

def self.tab()             TAB;             end