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 +4 -0
- data/lib/faster_csv.rb +14 -1
- data/test/tc_interface.rb +6 -0
- metadata +3 -3
data/CHANGELOG
CHANGED
data/lib/faster_csv.rb
CHANGED
@@ -75,7 +75,7 @@ require "stringio"
|
|
75
75
|
#
|
76
76
|
class FasterCSV
|
77
77
|
# The version of the installed library.
|
78
|
-
VERSION = "1.
|
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,
|
data/test/tc_interface.rb
CHANGED
@@ -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.
|
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.
|
7
|
-
date: 2007-
|
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
|