fech 1.3 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
 
7
7
  Fech makes it easy to parse electronic campaign finance filings[http://www.fec.gov/finance/disclosure/efile_search.shtml] by candidates, parties and political action committees from the Federal Election Commission. It lets you access filing attributes the same way regardless of filing version, and works as a framework for cleaning and filing data. Fech is an open source project of The New York Times, but contributions from anyone interested in working with F.E.C. filings are greatly appreciated.
8
8
 
9
- Latest version: 1.3
9
+ Latest version: 1.3.1
10
10
 
11
11
  Fech is tested under Ruby versions 1.8.7, 1.9.2 and 1.9.3.
12
12
 
@@ -16,7 +16,7 @@ Can be found at Fech's Github page[http://nytimes.github.com/Fech/].
16
16
 
17
17
  == News
18
18
 
19
- * Dec. 11, 2012: Version 1.3 released. Adds support for F13 filings from inaugural committees.
19
+ * Dec. 11, 2012: Versions 1.3, 1.3.1 released. Adds support for F13 filings from inaugural committees and fixes an encoding bug.
20
20
  * Dec. 3, 2012: Version 1.2 released. Fixes encoding errors under Ruby 1.9.3 for ASCII-encoded filings. Thanks to Sanjiv for the bug report.
21
21
  * Nov. 13, 2012: Version 1.1 released. CSVDoctor skips rows that don't match row type being searched for, which provides a performance boost, and smaller bugfixes for Form 99 handling and date-field conversions. Thanks to Sai for several patches.
22
22
  * June 16, 2012: Version 1.0.1 released. Bug-fix for older Form 2 support.
@@ -39,7 +39,7 @@ module Fech
39
39
  # the file to a function that will parse it individually.
40
40
  # @option opts [Boolean] :row_type yield only rows that match this type
41
41
  def self.parse_row(file_path, opts)
42
- File.open(file_path, 'r', :encoding => opts[:encoding]).each do |line|
42
+ File.open(file_path, "r:#{opts[:encoding]}").each do |line|
43
43
  # Skip empty lines
44
44
  next if line.strip.empty?
45
45
 
@@ -55,6 +55,8 @@ module Fech
55
55
  # @param [String] line the file's row to parse
56
56
  # @options opts :quote_char the quote_char to try initially
57
57
  def self.safe_line(line, opts)
58
+ # :encoding isn't a valid argument to Csv#parse_line
59
+ opts.delete(:encoding)
58
60
  begin
59
61
  parse_line(line, opts)
60
62
  rescue Fech::Csv::MalformedCSVError
@@ -1,3 +1,3 @@
1
1
  module Fech
2
- VERSION = "1.3"
2
+ VERSION = "1.3.1"
3
3
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fech::Csv do
4
+
5
+ before do
6
+ @filing = Fech::Filing.new(723604, :csv_parser => Fech::CsvDoctor)
7
+ @filing.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '723604.fec'))
8
+ end
9
+
10
+ it "should parse a filing using CsvDoctor" do
11
+ @filing.rows_like(//) { |row| nil }
12
+ end
13
+
14
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fech
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- version: "1.3"
9
+ - 1
10
+ version: 1.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Michael Strickland
@@ -280,6 +281,7 @@ files:
280
281
  - sources/headers/8.0.csv
281
282
  - sources/headers/ignore.csv
282
283
  - spec/comparison_spec.rb
284
+ - spec/csv_spec.rb
283
285
  - spec/data/425925.fec
284
286
  - spec/data/467627.fec
285
287
  - spec/data/723604.fec