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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4824cb04881e87ade843843235d2de41487bd60a
4
- data.tar.gz: 2a74e2c7ee9bfefa6a016c089cef0927d02a1fca
3
+ metadata.gz: b10cfc839e97bdcfbeec14d7bb586da18833d656
4
+ data.tar.gz: 48666f90a52e26381c8bf9b75f1188c5af4b4f5a
5
5
  SHA512:
6
- metadata.gz: 61286ce1ca7e1b6add7ae0d6fcce32d0bbd82ac5ca58a1cefa41257a2c4e241ccb922ee5ef832a44e624fa309608c13726d84e8e456955560860806ac46ee143
7
- data.tar.gz: c07f96e3265f6faf07d84dd305dc74e322cd27ce8bcae095aebadcbbd31482504b888cb6f3d16e74012714eeeeb878faa664dda3e15d773fdd68bf77b2b8b2d3
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
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Csv2Psql module
4
4
  module Csv2Psql
5
- VERSION = '0.0.18'
5
+ VERSION = '0.0.19'
6
6
  end
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.18
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