nesquikcsv 0.1.1 → 0.1.2

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: a8e84b01e1c81cf63e27c87bc0f37225431dcfbe
4
- data.tar.gz: 685ca38bd86618cf1cf896f726c02c1757398a61
3
+ metadata.gz: babce6b120898ac102e11c74f0875aab80e9f3d3
4
+ data.tar.gz: 157179256f0993baf0856627985597086697cde7
5
5
  SHA512:
6
- metadata.gz: c04fe921fb15442cc727ad15354a48dc55e63b27ce04cd553e31e54e50c299bec08bb2ebdb2cf11659ff5183a19a50be3c3b1d0df3db1ca5a2ed3e229d45a97d
7
- data.tar.gz: 50ce1b7cd325b7397b88189367172e1d59fe338a5ba6f1ba34d93e6f27443ebf0a9a30aeaf2b17f41ebec20fcba3ca9a353ba50ff7b09e132b61edf31c35b467
6
+ metadata.gz: 14fafb70587398a3208ad4a3e81017400398c3c61eb7aef4411d75a62c7b5c2852b9badfc329168b2f443168f3b5fe6e72e97ce887594ac5dc6e33b6ee8bc92e
7
+ data.tar.gz: fcd3df543fc53688e46e2792764ea2380a86f523e4964baf56823193236b26c81208a8deb41f909700edb6408594b09daf1bec4f1d4023157d5b050808b40766
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ test/version_tmp
18
18
  tmp
19
19
  lib/*.bundle
20
20
  lib/*.jar
21
+ lib/*.so
data/Rakefile CHANGED
@@ -6,6 +6,14 @@ spec = Gem::Specification.load('nesquikcsv.gemspec')
6
6
  require 'rake/extensiontask'
7
7
  Rake::ExtensionTask.new('csv_parser', spec)
8
8
 
9
+ task :console do
10
+ require 'irb'
11
+ require 'irb/completion'
12
+ require 'nesquikcsv'
13
+ ARGV.clear
14
+ IRB.start
15
+ end
16
+
9
17
  require 'rake/testtask'
10
18
  Rake::TestTask.new do |t|
11
19
  t.libs << "test"
@@ -1,3 +1,3 @@
1
1
  class NesquikCSV
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/nesquikcsv.rb CHANGED
@@ -40,8 +40,8 @@ class NesquikCSV
40
40
  end
41
41
 
42
42
  # Read all lines from the specified String into an array of arrays
43
- def self.parse(data, &block)
44
- csv = new(StringIO.new(data))
43
+ def self.parse(data, encoding="UTF-8", &block)
44
+ csv = new(StringIO.new(data), encoding)
45
45
  if block.nil?
46
46
  begin
47
47
  csv.read
@@ -53,20 +53,20 @@ class NesquikCSV
53
53
  end
54
54
  end
55
55
 
56
- def self.parse_line(line, encoding)
57
- r = CsvParser.parse_line(line, encoding)
58
- r.map {|e| e.force_encoding(encoding) unless e.nil?} unless r.nil?
56
+ def self.parse_line(line, encoding="UTF-8")
57
+ CsvParser.parse_line(line, encoding)
59
58
  end
60
59
 
61
60
  # Create new NesquikCSV wrapping the specified IO object
62
- def initialize(io)
61
+ def initialize(io, encoding="UTF-8")
63
62
  @io = io
63
+ @encoding = encoding
64
64
  end
65
65
 
66
66
  # Read from the wrapped IO passing each line as array to the specified block
67
67
  def each
68
68
  if block_given?
69
- while row = shift
69
+ while row = shift(@encoding)
70
70
  yield row
71
71
  end
72
72
  else
@@ -110,8 +110,8 @@ end
110
110
 
111
111
  class String
112
112
  # Equivalent to <tt>FasterCSV::parse_line(self)</tt>
113
- def parse_csv
114
- CsvParser.parse_line(self)
113
+ def parse_csv(encoding='UTF-8')
114
+ CsvParser.parse_line(self, encoding)
115
115
  end
116
116
  end
117
117
 
data/nesquikcsv.gemspec CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.extensions = ['ext/csv_parser/extconf.rb']
19
19
 
20
+ gem.add_dependency "test-unit"
21
+
20
22
  gem.add_development_dependency "rake-compiler"
21
23
 
22
24
  gem.license = 'MIT'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nesquikcsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Martty
@@ -10,18 +10,32 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-unit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake-compiler
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - '>='
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
33
  version: '0'
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - '>='
38
+ - - ">="
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
27
41
  description: Fastest-CSV fork with encoding support
@@ -32,14 +46,13 @@ extensions:
32
46
  - ext/csv_parser/extconf.rb
33
47
  extra_rdoc_files: []
34
48
  files:
35
- - .gitignore
49
+ - ".gitignore"
36
50
  - Gemfile
37
51
  - LICENSE
38
52
  - README.md
39
53
  - Rakefile
40
54
  - ext/csv_parser/extconf.rb
41
55
  - ext/csv_parser/parser.c
42
- - lib/csv_parser.so
43
56
  - lib/nesquikcsv.rb
44
57
  - lib/nesquikcsv/version.rb
45
58
  - nesquikcsv.gemspec
@@ -55,17 +68,17 @@ require_paths:
55
68
  - lib
56
69
  required_ruby_version: !ruby/object:Gem::Requirement
57
70
  requirements:
58
- - - '>='
71
+ - - ">="
59
72
  - !ruby/object:Gem::Version
60
73
  version: '0'
61
74
  required_rubygems_version: !ruby/object:Gem::Requirement
62
75
  requirements:
63
- - - '>='
76
+ - - ">="
64
77
  - !ruby/object:Gem::Version
65
78
  version: '0'
66
79
  requirements: []
67
80
  rubyforge_project:
68
- rubygems_version: 2.2.2
81
+ rubygems_version: 2.5.1
69
82
  signing_key:
70
83
  specification_version: 4
71
84
  summary: Fastest-CSV fork with encoding support
data/lib/csv_parser.so DELETED
Binary file