fech 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fech (0.1.4)
4
+ fech (0.1.5)
5
5
  fastercsv
6
6
  people
7
7
 
@@ -6,8 +6,9 @@ require 'fech/translator'
6
6
  require 'fech/mapped'
7
7
  require 'fech/fech_utils'
8
8
  require 'fech/map_generator'
9
+ require 'fech/csv'
9
10
 
10
11
  module Fech
11
12
  extend FechUtils
12
13
  DEFAULT_VERSION = "7.0"
13
- end
14
+ end
@@ -0,0 +1,12 @@
1
+ require 'fastercsv' unless RUBY_VERSION > '1.9'
2
+ require 'csv' if RUBY_VERSION > '1.9'
3
+
4
+ module Fech
5
+ begin
6
+ class Csv < CSV
7
+ end
8
+ rescue
9
+ class Csv < FasterCSV
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,5 @@
1
1
  require 'tmpdir'
2
2
  require 'open-uri'
3
- require 'fastercsv'
4
3
 
5
4
  module Fech
6
5
 
@@ -192,9 +191,9 @@ module Fech
192
191
  def parse_filing_version
193
192
  first = File.open(file_path).first
194
193
  if first.index("\034").nil?
195
- FasterCSV.parse(first).flatten[2]
194
+ Fech::Csv.parse(first).flatten[2]
196
195
  else
197
- FasterCSV.parse(first, :col_sep => "\034").flatten[2]
196
+ Fech::Csv.parse(first, :col_sep => "\034").flatten[2]
198
197
  end
199
198
  end
200
199
 
@@ -224,7 +223,7 @@ module Fech
224
223
  raise "File #{file_path} does not exist. Try invoking the .download method on this Filing object."
225
224
  end
226
225
  c = 0
227
- FasterCSV.foreach(file_path, :col_sep => delimiter, :skip_blanks => true) do |row|
226
+ Fech::Csv.foreach(file_path, :col_sep => delimiter, :skip_blanks => true) do |row|
228
227
  if opts[:with_index]
229
228
  yield [row, c]
230
229
  c += 1
@@ -245,4 +244,4 @@ module Fech
245
244
  end
246
245
 
247
246
  end
248
- end
247
+ end
@@ -40,7 +40,7 @@ module Fech
40
40
  # exists for it. If maps for two different versions are identical, they
41
41
  # are combined.
42
42
  FILING_VERSIONS.each do |version|
43
- FasterCSV.foreach(version_summary_file(source_dir, version)) do |row|
43
+ Fech::Csv.foreach(version_summary_file(source_dir, version)) do |row|
44
44
  # Each row of a version summary file contains the ordered list of
45
45
  # column names.
46
46
  data[row.first] ||= {}
@@ -1,3 +1,3 @@
1
1
  module Fech
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fech
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Strickland
@@ -180,6 +180,7 @@ files:
180
180
  - autotest/discover.rb
181
181
  - fech.gemspec
182
182
  - lib/fech.rb
183
+ - lib/fech/csv.rb
183
184
  - lib/fech/default_translations.rb
184
185
  - lib/fech/fech_utils.rb
185
186
  - lib/fech/filing.rb