csv2psql 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/csv2psql/analyzer/types/macaddr.rb +22 -0
- data/lib/csv2psql/frontend/csv.rb +1 -1
- data/lib/csv2psql/processor/processor.rb +2 -0
- data/lib/csv2psql/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b10cfc839e97bdcfbeec14d7bb586da18833d656
|
4
|
+
data.tar.gz: 48666f90a52e26381c8bf9b75f1188c5af4b4f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a7cb88c8f572c51a747fdb8029445ed13f967946848e19c27246f0740385e9d6b31165bbd741ecd2d97a2e5f02ed443274e64e1d438d7b0bd26bb350dee7bad
|
7
|
+
data.tar.gz: 7409042e49def5d650d894985faad9a7b105a95da7ecab4be130f5614ac8e1e8461a4538e600b43b86f9be85b9f38daa9a969846bee97ae1e6e027ccc712e185
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative 'base_analyzer'
|
4
|
+
|
5
|
+
module Csv2Psql
|
6
|
+
module Analyzers
|
7
|
+
# Bigint value matcher
|
8
|
+
class Macaddr < BaseAnalyzer
|
9
|
+
TYPE = :macaddr
|
10
|
+
CLASS = :special
|
11
|
+
WEIGHT = 4
|
12
|
+
|
13
|
+
RE = Regexp.new(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/)
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def analyze(val)
|
17
|
+
val && RE.match(val)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -10,7 +10,7 @@ module Csv2Psql
|
|
10
10
|
# Csv frontend class
|
11
11
|
class Csv < Base
|
12
12
|
def open(path, open_opts = 'rt', csv_opts = {}, &_block)
|
13
|
-
CSV.open(path, open_opts, csv_opts) do |csv|
|
13
|
+
CSV.open(path, open_opts, csv_opts.merge(:col_sep => csv_opts[:delimiter] || csv_opts[:col_sep] || ',')) do |csv|
|
14
14
|
Proc.new.call(csv)
|
15
15
|
end
|
16
16
|
end
|
@@ -94,7 +94,9 @@ module Csv2Psql
|
|
94
94
|
quote_char: opts['quote'] || DEFAULT_OPTIONS['quote']
|
95
95
|
}
|
96
96
|
res[:col_sep] = opts['delimiter'] if opts['delimiter']
|
97
|
+
res[:col_sep] = opts[:delimiter] if opts[:delimiter]
|
97
98
|
res[:row_sep] = opts['separator'] if opts['separator']
|
99
|
+
res[:row_sep] = opts[:separator] if opts[:separator]
|
98
100
|
res
|
99
101
|
end
|
100
102
|
|
data/lib/csv2psql/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv2psql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Korcak
|
@@ -292,6 +292,7 @@ files:
|
|
292
292
|
- lib/csv2psql/analyzer/types/cidr.rb
|
293
293
|
- lib/csv2psql/analyzer/types/date.rb
|
294
294
|
- lib/csv2psql/analyzer/types/decimal.rb
|
295
|
+
- lib/csv2psql/analyzer/types/macaddr.rb
|
295
296
|
- lib/csv2psql/analyzer/types/null.rb
|
296
297
|
- lib/csv2psql/analyzer/types/string.rb
|
297
298
|
- lib/csv2psql/analyzer/types/time.rb
|