csv 3.2.7 → 3.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +14 -0
- data/lib/csv/parser.rb +2 -4
- data/lib/csv/version.rb +1 -1
- data/lib/csv.rb +13 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c64817c16c8991fc2596875101449b5452326fe91bd05e4bb6a66213113525d6
|
4
|
+
data.tar.gz: 19d6d80d6959f6cde0ac651774ea795dbd0f949135cae021fef3983d94248f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 556f6582468d4a3c2994c12c25dba73b8db65e1a10f7306b9b5bc1fa345f47bf7872db1c603ddcd1a0eb359e7857c51a9874be2231dc821730ae62d15604c3b7
|
7
|
+
data.tar.gz: 348a25f4c1bb8e4fe0d71dc944e0a26165627803cb2528fc067642827fd3c253bda48aba179d3575950a7244bd4e8edf2eed9a99101952a07256a3f4f9d1e7fe
|
data/NEWS.md
CHANGED
data/lib/csv/parser.rb
CHANGED
@@ -414,8 +414,7 @@ class CSV
|
|
414
414
|
else
|
415
415
|
lineno = @lineno + 1
|
416
416
|
end
|
417
|
-
|
418
|
-
raise MalformedCSVError.new(message, lineno)
|
417
|
+
raise InvalidEncodingError.new(@encoding, lineno)
|
419
418
|
rescue UnexpectedError => error
|
420
419
|
if @scanner
|
421
420
|
ignore_broken_line
|
@@ -876,8 +875,7 @@ class CSV
|
|
876
875
|
!line.valid_encoding?
|
877
876
|
end
|
878
877
|
if index
|
879
|
-
|
880
|
-
raise MalformedCSVError.new(message, @lineno + index + 1)
|
878
|
+
raise InvalidEncodingError.new(@encoding, @lineno + index + 1)
|
881
879
|
end
|
882
880
|
end
|
883
881
|
Scanner.new(string)
|
data/lib/csv/version.rb
CHANGED
data/lib/csv.rb
CHANGED
@@ -102,14 +102,6 @@ require_relative "csv/writer"
|
|
102
102
|
|
103
103
|
# == \CSV
|
104
104
|
#
|
105
|
-
# === In a Hurry?
|
106
|
-
#
|
107
|
-
# If you are familiar with \CSV data and have a particular task in mind,
|
108
|
-
# you may want to go directly to the:
|
109
|
-
# - {Recipes for CSV}[doc/csv/recipes/recipes_rdoc.html].
|
110
|
-
#
|
111
|
-
# Otherwise, read on here, about the API: classes, methods, and constants.
|
112
|
-
#
|
113
105
|
# === \CSV Data
|
114
106
|
#
|
115
107
|
# \CSV (comma-separated values) data is a text representation of a table:
|
@@ -854,6 +846,15 @@ class CSV
|
|
854
846
|
end
|
855
847
|
end
|
856
848
|
|
849
|
+
# The error thrown when the parser encounters invalid encoding in CSV.
|
850
|
+
class InvalidEncodingError < MalformedCSVError
|
851
|
+
attr_reader :encoding
|
852
|
+
def initialize(encoding, line_number)
|
853
|
+
@encoding = encoding
|
854
|
+
super("Invalid byte sequence in #{encoding}", line_number)
|
855
|
+
end
|
856
|
+
end
|
857
|
+
|
857
858
|
#
|
858
859
|
# A FieldInfo Struct contains details about a field's position in the data
|
859
860
|
# source it was read from. CSV will pass this Struct to some blocks that make
|
@@ -1314,8 +1315,8 @@ class CSV
|
|
1314
1315
|
#
|
1315
1316
|
# Arguments:
|
1316
1317
|
# * Argument +path_or_io+ must be a file path or an \IO stream.
|
1317
|
-
# * Argument +mode+, if given, must be a \File mode
|
1318
|
-
# See {
|
1318
|
+
# * Argument +mode+, if given, must be a \File mode.
|
1319
|
+
# See {Access Modes}[https://docs.ruby-lang.org/en/master/File.html#class-File-label-Access+Modes].
|
1319
1320
|
# * Arguments <tt>**options</tt> must be keyword options.
|
1320
1321
|
# See {Options for Parsing}[#class-CSV-label-Options+for+Parsing].
|
1321
1322
|
# * This method optionally accepts an additional <tt>:encoding</tt> option
|
@@ -1521,8 +1522,8 @@ class CSV
|
|
1521
1522
|
#
|
1522
1523
|
# * Argument +path+, if given, must be the path to a file.
|
1523
1524
|
# :include: ../doc/csv/arguments/io.rdoc
|
1524
|
-
# * Argument +mode+, if given, must be a \File mode
|
1525
|
-
# See {
|
1525
|
+
# * Argument +mode+, if given, must be a \File mode.
|
1526
|
+
# See {Access Modes}[https://docs.ruby-lang.org/en/master/File.html#class-File-label-Access+Modes].
|
1526
1527
|
# * Arguments <tt>**options</tt> must be keyword options.
|
1527
1528
|
# See {Options for Generating}[#class-CSV-label-Options+for+Generating].
|
1528
1529
|
# * This method optionally accepts an additional <tt>:encoding</tt> option
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|