fastercsv 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of FasterCSV.
4
4
 
5
- == 1.2.1
5
+ == 1.2.3
6
+
7
+ * Default to the system line ending when passed a GzipWriter object to wrap.
8
+
9
+ == 1.2.2
6
10
 
7
11
  * Worked around GzipReader's lack of a seek() method so we could still use
8
12
  automatic row separator detection with them.
@@ -75,7 +75,7 @@ require "stringio"
75
75
  #
76
76
  class FasterCSV
77
77
  # The version of the installed library.
78
- VERSION = "1.2.2".freeze
78
+ VERSION = "1.2.3".freeze
79
79
 
80
80
  #
81
81
  # A FasterCSV::Row is part Array and part Hash. It retains an order for the
@@ -1621,7 +1621,8 @@ class FasterCSV
1621
1621
 
1622
1622
  # automatically discover row separator when requested
1623
1623
  if @row_sep == :auto
1624
- if [ARGF, STDIN, STDOUT, STDERR].include? @io
1624
+ if [ARGF, STDIN, STDOUT, STDERR].include?(@io) or
1625
+ (defined?(Zlib) and @io.class == Zlib::GzipWriter)
1625
1626
  @row_sep = $INPUT_RECORD_SEPARATOR
1626
1627
  else
1627
1628
  begin
@@ -158,6 +158,22 @@ class TestFasterCSVFeatures < Test::Unit::TestCase
158
158
  assert_equal("\r\n", zipped.instance_eval { @row_sep })
159
159
  end
160
160
 
161
+ def test_gzip_writer_bug_fix
162
+ file = File.join(File.dirname(__FILE__), "temp.gz")
163
+ zipped = nil
164
+ assert_nothing_raised(NoMethodError) do
165
+ zipped = FasterCSV.new(Zlib::GzipWriter.open(file))
166
+ end
167
+ zipped << %w[one two three]
168
+ zipped << [1, 2, 3]
169
+ zipped.close
170
+
171
+ assert( Zlib::GzipReader.open(file) { |f| f.read }.
172
+ include?($INPUT_RECORD_SEPARATOR),
173
+ "@row_sep did not default" )
174
+ File.unlink(file)
175
+ end
176
+
161
177
  def test_version
162
178
  assert_not_nil(FasterCSV::VERSION)
163
179
  assert_instance_of(String, FasterCSV::VERSION)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: fastercsv
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.2
7
- date: 2007-12-01 00:00:00 -06:00
6
+ version: 1.2.3
7
+ date: 2007-12-02 00:00:00 -06:00
8
8
  summary: FasterCSV is CSV, but faster, smaller, and cleaner.
9
9
  require_paths:
10
10
  - lib