see_as_vee 0.4.5 → 0.4.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5799a95416f1f098a5251d0813644f9dea12aad
4
- data.tar.gz: 9e0add6027150787f65b7208ac7bfd341a46676d
3
+ metadata.gz: 0410a1251a8f3d658906cab07df0f3f6504e574d
4
+ data.tar.gz: 18017fbe9ec584115ba2fd657cbf4b74e9fc7478
5
5
  SHA512:
6
- metadata.gz: 65166484784b536ec9a28e175075c10d422c912f24de14464ee577c819ef4e475bffd24ef16fad4934850949ad86f8f2dc630866d224fc30fdec60ff97f44471
7
- data.tar.gz: 7ab8394d15d285433166571ba86adc2e05c476267a7e8fb438daae183dc1b9d010bb7f0220cf49972f8e3faf6b73e7896bbeb46db6aaa21efbc51d873dec007f
6
+ metadata.gz: ffd9932a79b1382e7ff8980f18487b7fb4c1a880e715f3f7fdc7c4fc5556a4ce785270e1c9eba3dcb07b3ab9c1d84bfb684f2e4d2bb2ad31ee745200892195bb
7
+ data.tar.gz: 863c25f7e2f5409e7245d384f88383d7ec9f723111983fd9574ef45db5cacf98c30b9b2ca78b17bad305635018d07f5baf18135f39432f24188749197578bf11
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-01-16 15:21:47 +0100 using RuboCop version 0.42.0.
3
+ # on 2017-01-16 15:57:05 +0100 using RuboCop version 0.42.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -14,6 +14,14 @@ Style/AlignParameters:
14
14
  Exclude:
15
15
  - 'spec/see_as_vee_spec.rb'
16
16
 
17
+ # Offense count: 2
18
+ # Cop supports --auto-correct.
19
+ # Configuration parameters: PreferredDelimiters.
20
+ Style/PercentLiteralDelimiters:
21
+ Exclude:
22
+ - 'lib/see_as_vee/producers/hashes.rb'
23
+ - 'spec/producers/hashes_spec.rb'
24
+
17
25
  # Offense count: 160
18
26
  # Cop supports --auto-correct.
19
27
  # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
data/README.md CHANGED
@@ -88,6 +88,23 @@ The returned value is an array of [validation results](http://dry-rb.org/gems/dr
88
88
 
89
89
  ### Expand `GROUP_CONCAT` column
90
90
 
91
+ From the version `0.4.6` we support expanding the column given as an `Array` instance
92
+
93
+ ```ruby
94
+ ▶ require 'see_as_vee'
95
+ #⇒ true
96
+ ▶ SeeAsVee.csv(
97
+ ▷ [{name: 'Aleksei', value: 42, nicks: %w|matiushkin mudasobwa am-kantox|},
98
+ ▷ {name: 'Saverio', value: 3.14, nicks: %w|trioni rewritten saverio-kantox|}],
99
+ ▷ ungroup: :nicks)
100
+ #⇒ #<File:/tmp/am/see_as_vee20161109-6031-6he5m7.csv>
101
+ # -rw------- 1 am am 32 nov 9 07:18 /tmp/am/see_as_vee20161109-6031-6he5m7.csv
102
+ ▶ .cat /tmp/am/see_as_vee20161109-6031-6he5m7.csv
103
+ #⇒ name value nick 1 nick 2 nick 3
104
+ # Aleksei 42 matiushkin mudasobwa am-kantox
105
+ # Saverio 3.14 trioni rewritten saverio-kantox
106
+ ```
107
+
91
108
  From the version `0.4.5` we support expanding the column produced by `GROUP_CONCAT`
92
109
 
93
110
  ```ruby
@@ -96,7 +113,7 @@ From the version `0.4.5` we support expanding the column produced by `GROUP_CONC
96
113
  ▶ SeeAsVee.csv(
97
114
  ▷ [{name: 'Aleksei', value: 42, nicks: 'matiushkin,mudasobwa,am-kantox'},
98
115
  ▷ {name: 'Saverio', value: 3.14, nicks: 'trioni,rewritten,saverio-kantox'}],
99
- col_sep: "\t", ungroup: :nicks)
116
+ ▷ ungroup: :nicks)
100
117
  #⇒ #<File:/tmp/am/see_as_vee20161109-6031-6he5m7.csv>
101
118
  # -rw------- 1 am am 32 nov 9 07:18 /tmp/am/see_as_vee20161109-6031-6he5m7.csv
102
119
  ▶ .cat /tmp/am/see_as_vee20161109-6031-6he5m7.csv
@@ -61,7 +61,11 @@ module SeeAsVee
61
61
  hashes.tap do |hs|
62
62
  hs.each do |hash|
63
63
  columns.each do |column|
64
- hash.delete(column).split(delimiter).each.with_index(1) do |value, idx|
64
+ case c = hash.delete(column)
65
+ when Array then c
66
+ when String then c.split(delimiter)
67
+ else [c.inspect]
68
+ end.each.with_index(1) do |value, idx|
65
69
  hash["#{column}_#{idx}"] = value
66
70
  end
67
71
  end
@@ -1,3 +1,3 @@
1
1
  module SeeAsVee
2
- VERSION = '0.4.5'.freeze
2
+ VERSION = '0.4.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: see_as_vee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Matiushkin