Class: CsvReader::Parser
- Inherits:
-
Object
- Object
- CsvReader::Parser
- 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: "" )
- HUMAN =
ParserStd.new( hashtag: true )
- 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 =
(strict) tab-separated
ParserTab.new
- TABLE =
space-separated e.g /[ t]+/
ParserTable.new
- FIXED =
ParserFixed.new
- JSON =
ParserJson.new
- YAML =
ParserYaml.new
Class Method Summary collapse
-
.default ⇒ Object
alternative alias for DEFAULT.
-
.excel ⇒ Object
alternative alias for EXCEL.
- .f ⇒ Object
- .fix ⇒ Object
- .fixed ⇒ Object
- .hum ⇒ Object
- .human ⇒ Object
-
.hxl ⇒ Object
HXL (humanitarian eXchange language).
- .j ⇒ Object
- .json ⇒ Object
- .mysql ⇒ Object
- .n ⇒ Object
- .num ⇒ Object
- .numeric ⇒ Object
- .postgres ⇒ Object
- .postgres_text ⇒ Object
- .postgresql ⇒ Object
- .postgresql_text ⇒ Object
-
.rfc4180 ⇒ Object
alternative alias for RFC4180.
-
.strict ⇒ Object
alternative alias for STRICT.
- .tab ⇒ Object
- .table ⇒ Object
- .y ⇒ Object
- .yaml ⇒ Object
Class Method Details
.default ⇒ Object
alternative alias for DEFAULT
83 |
# File 'lib/csvreader/base.rb', line 83 def self.default() DEFAULT; end |
.excel ⇒ Object
alternative alias for EXCEL
93 |
# File 'lib/csvreader/base.rb', line 93 def self.excel() EXCEL; end |
.f ⇒ Object
104 |
# File 'lib/csvreader/base.rb', line 104 def self.f() fixed; end |
.fix ⇒ Object
103 |
# File 'lib/csvreader/base.rb', line 103 def self.fix() fixed; end |
.fixed ⇒ Object
102 |
# File 'lib/csvreader/base.rb', line 102 def self.fixed() FIXED; end |
.hum ⇒ Object
88 |
# File 'lib/csvreader/base.rb', line 88 def self.hum() human; end |
.human ⇒ Object
87 |
# File 'lib/csvreader/base.rb', line 87 def self.human() HUMAN; end |
.hxl ⇒ Object
HXL (humanitarian eXchange language)
89 |
# File 'lib/csvreader/base.rb', line 89 def self.hxl() human; end |
.j ⇒ Object
107 |
# File 'lib/csvreader/base.rb', line 107 def self.j() json; end |
.json ⇒ Object
106 |
# File 'lib/csvreader/base.rb', line 106 def self.json() JSON; end |
.mysql ⇒ Object
94 |
# File 'lib/csvreader/base.rb', line 94 def self.mysql() MYSQL; end |
.n ⇒ Object
86 |
# File 'lib/csvreader/base.rb', line 86 def self.n() numeric; end |
.num ⇒ Object
85 |
# File 'lib/csvreader/base.rb', line 85 def self.num() numeric; end |
.numeric ⇒ Object
84 |
# File 'lib/csvreader/base.rb', line 84 def self.numeric() NUMERIC; end |
.postgres ⇒ Object
96 |
# File 'lib/csvreader/base.rb', line 96 def self.postgres() postgresql; end |
.postgres_text ⇒ Object
98 |
# File 'lib/csvreader/base.rb', line 98 def self.postgres_text() postgresql_text; end |
.postgresql ⇒ Object
95 |
# File 'lib/csvreader/base.rb', line 95 def self.postgresql() POSTGRESQL; end |
.postgresql_text ⇒ Object
97 |
# File 'lib/csvreader/base.rb', line 97 def self.postgresql_text() POSTGRESQL_TEXT; end |
.rfc4180 ⇒ Object
alternative alias for RFC4180
92 |
# File 'lib/csvreader/base.rb', line 92 def self.rfc4180() RFC4180; end |
.strict ⇒ Object
alternative alias for STRICT
91 |
# File 'lib/csvreader/base.rb', line 91 def self.strict() STRICT; end |
.tab ⇒ Object
100 |
# File 'lib/csvreader/base.rb', line 100 def self.tab() TAB; end |
.table ⇒ Object
101 |
# File 'lib/csvreader/base.rb', line 101 def self.table() TABLE; end |
.y ⇒ Object
109 |
# File 'lib/csvreader/base.rb', line 109 def self.y() yaml; end |
.yaml ⇒ Object
108 |
# File 'lib/csvreader/base.rb', line 108 def self.yaml() YAML; end |