fastercsv 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of FasterCSV.
4
4
 
5
+ == 1.5.1
6
+
7
+ * A bug fix for deleting blank Table rows from Andy Hartford.
8
+ * Added gem build instructions.
9
+
5
10
  == 1.5.0
6
11
 
7
12
  * The main parser has been rewritten by Timothy Elliott to avoid big input
data/INSTALL CHANGED
@@ -14,6 +14,12 @@ version, simply enter the following into your command prompt:
14
14
  You must have RubyGems[http://rubyforge.org/projects/rubygems/] installed for
15
15
  the above to work.
16
16
 
17
+ If you want to build the gem locally, make sure you have
18
+ Rake[http://rubyforge.org/projects/rake/] installed then run the following
19
+ command:
20
+
21
+ $ rake package
22
+
17
23
  == Installing Manually
18
24
 
19
25
  Download the latest version of FasterCSV from the
@@ -82,7 +82,7 @@ require "stringio"
82
82
  #
83
83
  class FasterCSV
84
84
  # The version of the installed library.
85
- VERSION = "1.5.0".freeze
85
+ VERSION = "1.5.1".freeze
86
86
 
87
87
  #
88
88
  # A FasterCSV::Row is part Array and part Hash. It retains an order for the
@@ -249,10 +249,12 @@ class FasterCSV
249
249
  # returned, or +nil+ if a pair could not be found.
250
250
  #
251
251
  def delete(header_or_index, minimum_index = 0)
252
- if header_or_index.is_a? Integer # by index
252
+ if header_or_index.is_a? Integer # by index
253
253
  @row.delete_at(header_or_index)
254
- else # by header
255
- @row.delete_at(index(header_or_index, minimum_index))
254
+ elsif i = index(header_or_index, minimum_index) # by header
255
+ @row.delete_at(i)
256
+ else
257
+ [ ]
256
258
  end
257
259
  end
258
260
 
@@ -72,6 +72,11 @@ class TestFasterCSVInterface < Test::Unit::TestCase
72
72
  assert_equal(%w{1 2 3}, row)
73
73
  end
74
74
 
75
+ def test_parse_line_with_empty_lines
76
+ assert_equal(nil, FasterCSV.parse_line("")) # to signal eof
77
+ assert_equal(Array.new, FasterCSV.parse_line("\n1,2,3"))
78
+ end
79
+
75
80
  def test_read_and_readlines
76
81
  assert_equal( @expected,
77
82
  FasterCSV.read(@path, :col_sep => "\t", :row_sep => "\r\n") )
@@ -319,6 +319,12 @@ class TestFasterCSVTable < Test::Unit::TestCase
319
319
  END_RESULT
320
320
  end
321
321
 
322
+ def test_delete_with_blank_rows
323
+ data = "col1,col2\nra1,ra2\n\nrb1,rb2"
324
+ table = FasterCSV.parse(data, :headers => true)
325
+ assert_equal(["ra2", nil, "rb2"], table.delete("col2"))
326
+ end
327
+
322
328
  def test_delete_if
323
329
  ######################
324
330
  ### Mixed/Row Mode ###
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastercsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-15 00:00:00 -05:00
12
+ date: 2010-01-30 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements: []
92
92
 
93
93
  rubyforge_project: fastercsv
94
- rubygems_version: 1.3.4
94
+ rubygems_version: 1.3.5
95
95
  signing_key:
96
96
  specification_version: 3
97
97
  summary: FasterCSV is CSV, but faster, smaller, and cleaner.