Module: CSVPP
- Defined in:
- lib/csvpp.rb,
lib/csvpp/os.rb,
lib/csvpp/cli.rb,
lib/csvpp/format.rb,
lib/csvpp/parser.rb,
lib/csvpp/version.rb,
lib/csvpp/conversions.rb,
lib/csvpp/formats_client.rb,
lib/csvpp/core_extensions.rb,
lib/csvpp/sqlite_importer.rb
Defined Under Namespace
Modules: Conversions, CoreExtensions, OS
Classes: CLI, Format, FormatsClient, Parser, SqliteImporter
Constant Summary
collapse
- DEFAULT_COL_SEP =
'|'
- VERSION =
"0.4.0"
Class Method Summary
collapse
-
.json(input:, format:, convert_type: true, col_sep: DEFAULT_COL_SEP) ⇒ String
-
.parse(input:, format:, col_sep: DEFAULT_COL_SEP, convert_type: true, &block) ⇒ Array<Object>
-
.parse_str(input:, format:, col_sep: DEFAULT_COL_SEP, convert_type: true, &block) ⇒ Array<Object>
Class Method Details
.json(input:, format:, convert_type: true, col_sep: DEFAULT_COL_SEP) ⇒ String
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# 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) ⇒ Array<Object>
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# 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) ⇒ Array<Object>
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# 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
|