csv 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a240b6e6a405972ac623bbc1c369d6833e57b449606ce02d01b183604d621353
4
- data.tar.gz: 73cb12bafe60a7331b13d9d7b75837007c55044b78d4580d422ba123af692d25
3
+ metadata.gz: b0c308f4cca10d6b48a2268e992fa545918c6cbe99837b83ec048b55eb76b702
4
+ data.tar.gz: 8661eb5e276abdeb5e939e3c2359d6ee991199550cfaa8e623496946fad17b8f
5
5
  SHA512:
6
- metadata.gz: 739201c445c8b6ad1644d2ede0522635d10b83a1a2253cea7386190749b762d0301fc15af98c55976180263a210b5c954f49428897760682675db420704543a6
7
- data.tar.gz: 6b55c8703407e7fdd09075ce5ce798d66fad1317b65b19b035cde5653f29c13087775cbf1117cdb044689b6a33c031c9624c503eb3c441a817741fdc5dc6084e
6
+ metadata.gz: 5875a4b446bd22fbdb0ab1a829576e219b64aa80a66f27e73ae487ed7fa6fb09429f8f3185ab8b08c07ee30a49204b98acd1d7a72a97c9ec89234d79dc597553
7
+ data.tar.gz: bda1a607b00312b0e4bc0e2d444670d5f9661251ad73cb2061baeb695cb264af0a06f3bf44fc4d00d6406a1b61f0d4bbdfb8e6fd036d276f51fd30fec4f179e3
data/NEWS.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # News
2
2
 
3
+ ## 3.0.4 - 2019-01-25
4
+
5
+ ### Improvements
6
+
7
+ * Removed duplicated `CSV::Row#include?` implementations.
8
+ [GitHub#69][Patch by Max Schwenk]
9
+
10
+ * Removed duplicated `CSV::Row#header?` implementations.
11
+ [GitHub#70][Patch by Max Schwenk]
12
+
13
+ ### Fixes
14
+
15
+ * Fixed a typo in document.
16
+ [GitHub#72][Patch by Artur Beljajev]
17
+
18
+ * Fixed a compatibility bug when row headers are changed.
19
+ [GitHub#71][Reported by tomoyuki kosaka]
20
+
21
+ ### Thanks
22
+
23
+ * Max Schwenk
24
+
25
+ * Artur Beljajev
26
+
27
+ * tomoyuki kosaka
28
+
3
29
  ## 3.0.3 - 2019-01-12
4
30
 
5
31
  ### Improvements
data/lib/csv.rb CHANGED
@@ -1244,7 +1244,6 @@ class CSV
1244
1244
  end
1245
1245
  end
1246
1246
  _headers = headers
1247
- _headers = headers
1248
1247
  str << " headers:" << _headers.inspect if _headers
1249
1248
  str << ">"
1250
1249
  begin
@@ -130,6 +130,7 @@ class CSV
130
130
  alias_method :include?, :has_key?
131
131
  alias_method :key?, :has_key?
132
132
  alias_method :member?, :has_key?
133
+ alias_method :header?, :has_key?
133
134
 
134
135
  #
135
136
  # :call-seq:
@@ -286,12 +287,6 @@ class CSV
286
287
  index.nil? ? nil : index + minimum_index
287
288
  end
288
289
 
289
- # Returns +true+ if +name+ is a header for this row, and +false+ otherwise.
290
- def header?(name)
291
- headers.include? name
292
- end
293
- alias_method :include?, :header?
294
-
295
290
  #
296
291
  # Returns +true+ if +data+ matches a field in this row, and +false+
297
292
  # otherwise.
@@ -19,7 +19,7 @@ class CSV
19
19
  # The optional +headers+ parameter can be set to Array of headers.
20
20
  # If headers aren't set, headers are fetched from CSV::Row objects.
21
21
  # Otherwise, headers() method will return headers being set in
22
- # headers arugument.
22
+ # headers argument.
23
23
  #
24
24
  # A CSV::Table object supports the following Array methods through
25
25
  # delegation:
@@ -133,10 +133,15 @@ class CSV
133
133
 
134
134
  #
135
135
  # Returns the headers for the first row of this table (assumed to match all
136
- # other rows). An empty Array is returned for empty tables.
136
+ # other rows). The headers Array passed to CSV::Table.new is returned for
137
+ # empty tables.
137
138
  #
138
139
  def headers
139
- @headers.dup
140
+ if @table.empty?
141
+ @headers.dup
142
+ else
143
+ @table.first.headers
144
+ end
140
145
  end
141
146
 
142
147
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  class CSV
4
4
  # The version of the installed library.
5
- VERSION = "3.0.3"
5
+ VERSION = "3.0.4"
6
6
  end
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.0.3
4
+ version: 3.0.4
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: 2019-01-12 00:00:00.000000000 Z
12
+ date: 2019-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -109,7 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubygems_version: 3.0.2
112
+ rubyforge_project:
113
+ rubygems_version: 2.7.6
113
114
  signing_key:
114
115
  specification_version: 4
115
116
  summary: CSV Reading and Writing