fastercsv 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of FasterCSV.
4
4
 
5
+ == 1.2.0
6
+
7
+ * Added the FasterCSV::table() shortcut.
8
+
5
9
  == 1.1.1
6
10
 
7
11
  * Added a <tt>:force_quotes</tt> output option.
@@ -75,7 +75,7 @@ require "stringio"
75
75
  #
76
76
  class FasterCSV
77
77
  # The version of the installed library.
78
- VERSION = "1.1.1".freeze
78
+ VERSION = "1.2.0".freeze
79
79
 
80
80
  #
81
81
  # A FasterCSV::Row is part Array and part Hash. It retains an order for the
@@ -1217,6 +1217,19 @@ class FasterCSV
1217
1217
  read(*args)
1218
1218
  end
1219
1219
 
1220
+ #
1221
+ # A shortcut for:
1222
+ #
1223
+ # FasterCSV.read( path, { :headers => true,
1224
+ # :converters => :numeric,
1225
+ # :header_converters => :symbol }.merge(options) )
1226
+ #
1227
+ def self.table(path, options = Hash.new)
1228
+ read( path, { :headers => true,
1229
+ :converters => :numeric,
1230
+ :header_converters => :symbol }.merge(options) )
1231
+ end
1232
+
1220
1233
  #
1221
1234
  # This constructor will wrap either a String or IO object passed in +data+ for
1222
1235
  # reading and/or writing. In addition to the FasterCSV instance methods,
@@ -89,6 +89,12 @@ class TestFasterCSVInterface < Test::Unit::TestCase
89
89
  end
90
90
  assert_equal(@expected, data)
91
91
  end
92
+ []
93
+ def test_table
94
+ table = FasterCSV.table(@path, :col_sep => "\t", :row_sep => "\r\n")
95
+ assert_instance_of(FasterCSV::Table, table)
96
+ assert_equal([[:"1", :"2", :"3"], [4, 5, nil]], table.to_a)
97
+ end
92
98
 
93
99
  def test_shift # aliased as gets() and readline()
94
100
  FasterCSV.open(@path, "r+", :col_sep => "\t", :row_sep => "\r\n") do |csv|
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.1
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: fastercsv
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.1
7
- date: 2007-01-31 00:00:00 -06:00
6
+ version: 1.2.0
7
+ date: 2007-02-07 00:00:00 -06:00
8
8
  summary: FasterCSV is CSV, but faster, smaller, and cleaner.
9
9
  require_paths:
10
10
  - lib