dorian-csv-uniq 1.0.0 → 1.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/csv-uniq +3 -13
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8890562977177594a6271149092412127fbf019dbd43bcd0b011f6333f910541
4
- data.tar.gz: 564679dfac50c4a80084ef502964d01dadafd36e709c73c9422b734e249f7061
3
+ metadata.gz: 6f5a3736fa1e9c706554263c8294fb2bf06d5d0e196783e9a61521beb41a15f1
4
+ data.tar.gz: 111c23b8feb2169bbfc33cbe942715b95cf787b1520c8098ee601b037075be86
5
5
  SHA512:
6
- metadata.gz: 1018b2ffbf3518c1862de7c47b289f44bf23dfa869343e0c361b15e7a6756ddbfb8a0e4c7ac82274c4f19aaf88af76e767069142d90594f2b45c1d16e5205da9
7
- data.tar.gz: 7b66353370765cba05dc18ab12d436d71b541ec008f6dfb67c1986a78dc69b806735937d71be08510d0446d0e802971a545e6adf4d8dccab7134833f8d1be792
6
+ metadata.gz: a2e8335b3cf5d963752791665a76e60739097d8c409e59db54f782e8b1a8f8e5aac5c84b590070b6559546c41cf7fe5d6a1d05935a426b09e6cb354e5e96c37b
7
+ data.tar.gz: 3b9af5800134818fa5193e68e5084eefa7a01c3f7eccf9f7910a5628ff7d64c3d05f037f478b8b85844e74da35d644a70512d9c2bcec212349ca28b8b987db92
data/bin/csv-uniq CHANGED
@@ -21,7 +21,7 @@ parsed =
21
21
  abort parsed.help if parsed.options.help
22
22
 
23
23
  if parsed.options.version
24
- abort File.read(File.expand_path("../../VERSION", __FILE__))
24
+ abort File.read(File.expand_path("../VERSION", __dir__))
25
25
  end
26
26
 
27
27
  keys = parsed.arguments
@@ -37,19 +37,9 @@ puts(
37
37
  inputs.map.with_index do |input, index|
38
38
  input = CSV.parse(input, headers:)
39
39
 
40
- if parsed.options.print_headers && index.zero?
41
- output << (keys || input.headers).map do |key|
42
- if input.headers.include?(key)
43
- key
44
- elsif key.to_i.to_s == key
45
- input.headers[key.to_i]
46
- else
47
- key
48
- end
49
- end
50
- end
40
+ output << input.headers if parsed.options.print_headers && index.zero?
51
41
 
52
- input.map do |row|
42
+ input.uniq do |row|
53
43
  (
54
44
  keys || (headers && input.headers) || (0...input.first.size)
55
45
  ).map { |key| row[key.to_i.to_s == key ? key.to_i : key] }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-csv-uniq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-24 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv
@@ -57,9 +57,9 @@ require_paths:
57
57
  - lib
58
58
  required_ruby_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 3.3.4
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="